-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to map class interface declarations #35
Comments
hi, thanks for reporting.
as described, this is a bug.
no. strange... as there is no patch file(s) specified in the command line, dxp is just applying transforms. the strange thing is that class name rewriting is mostly a responsibility of dexlib2. my code rewrites class names/references generally without knowing what the references are (a class definition, an extends clause, an implement clause, part of a member reference, etc). so generally speaking, it is odd (but not impossible) that some names/refs are rewritten and other are not. (yes, this being a dexlib2 bug would explain things, but i consider it unlikely.) i do not remember the first thing about the code that i wrote a few months ago. i will have to look into this further... |
Cheers, yeah my current "process" as such is running dexpatcher in a script with the mapping file like this against the original app dex files to create a remapped copy of the dex files. |
this is similar to one workflow planed for the next dxp-gradle... when it happens |
ok, so sorry for taking this long. so today i got to take a look at this. after a quick look dexlib2 didn't seem to be causing this. next i looked at my code... man! what the heck, it took me a long while to understand what was going on there after a few months of not looking. way too involved, i don't think i'll be able to write another transform if i ever needed to. anyway, i looked at the code for two whole hours and couldn't find the bug. then i turned to your sample and... there is no bug! everything works as intended. the bug is in the decompiler you used. take a look at your own CFR outputs the signature is (the equivalent of) a string attribute. in java bytecode it encodes a generic type using a defined syntax before type erasure generates the raw type that is actually used in bytecode. AFAIK it is ignored by the JVM and is only used by the reflection API to provide info on generic types. in dalvik bytecode it is even less: a string of unspecified content. this is why:
decompilers need signatures in order to better decompile generic code. but they should know that their content could be missing, incorrect, or doctored to attack the decompiler. this is a CFR bug (and also a Procyon bug). this bug MAY have been fixed in current CFR, as i remember a discussion relative to bad signatures. i have no plans to map signatures in dxp. i expect properly configured obfuscators to strip them: there seems to be (almost) no reason to leave all that valuable info in bytecode if it it's (mostly) ignored by the VM. i would support them if dexlib2 did, but it doesn't. obfuscators could fake signatures instead of just strip them. it could change what to do:
(but even with sanity checks, decompilation of mapped code will be incorrect of the mapped type is a type parameter. the only solution to get correct code would be to disable signature processing.)
|
Ah, thanks so much for delving down into it, and sorry for asking about a bug that wasn't really from your codebase! The obfuscator being used here clearly writes signatures that match the new obfuscated names. I was already using the latest CFR with signature verification updates, though I might not have been using the new signature fixup switch properly in this test here - I was initially using jadx and getting the same results so hadn't thought it was the decompiler again. Thanks again, you've been a big help! |
Actually, I just re-tried a build from the current CFR master with the new switch to turn off signatures and it still gives the incorrect Hi @leibnitz27 I think I've found another weird signature issue with re-mapping and CFR. I would assume it's related to #33 (comment) but the solution you added for that one doesn't seem to fix this. |
CFR with sanity checks should reject the siganture i think as there is no way for type erasure to go from the sig to the raw type. also |
hi @leibnitz27, it seems basically there is a zip in the OP here which has a
here is a view of the problem bytecode... thanks! |
Hi there,
I've been working on automating the mapping.txt generation for one of my projects lately and have run into an issue with some of the
--map-source --map mapping.txt
usage. Not sure if it's a bug or a setting I'm missing.In a situation like
with
com.foo.iface
I'm trying to map
iface
tomyface
, egmapping.txt
Now in patched.dex
com.foo.iface
class is correctly renamed tocom.foo.myface
and in the original class, the instance variable type is changed, however the
implements
details haven't:Is there a
--pre-transform
or similar setting I'm missing?I've attached the reproduction case files listed here if it is a bug / missing feature.
Thanks!
noimplements.zip
The text was updated successfully, but these errors were encountered: