-
Notifications
You must be signed in to change notification settings - Fork 445
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
Dex Writing Error after Simplification #150
Comments
Key error is: This is from Dexlib. Likely, during optimization, several execution branches are pruned and control flow collapses to a single address. Will need to come up with a work around or figure out a good way of changing the switch. It might be possible to add some nops and jump to those. Might also be possible to remove the switch, but robust modification of control flow gets a bit tricky. To help with searching, here's the log:
|
One workaround, though not good, is to only optimize classes / methods you care about. Some methods optimize without upsetting dexlib. |
its possible to found exact location of error so i can patch with nop as you suggested ? skipping other classes is not best idea though as if someone need to simplify those similer errorpron classes they will face writing issue. something in simplify or dexlib should be tweaked to handle control flow properly . right sir ? |
What I said was for "future me" to understand better what to do. By "adding
nops" I meant "simplify should add nops when multiple switch branches point
to the same address and then modify the jump addresses to those nops so
that there's no overlap". It's not something you could do manually, unless
you were debugging simplify.
As for the work-around, I qualified the work around as "not good" and
you're correctly pointing out explicitly why it's not good.
…On Mon, Oct 26, 2020 at 10:42 AM Apkunpacker ***@***.***> wrote:
its possible to found exact location of error so i can patch with nop as
you suggested ? skipping other classes is not best idea though as if
someone need to simplify those similer errorpron classes they will face
writing issue. something in simplify or dexlib should be tweaked to handle
control flow properly . right sir ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#150 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKLG4WD5GNDBRWIAGLZMFTSMWYGTANCNFSM4S67CEVA>
.
|
okay sir as you are creater you know it perfectly that how it work and how to fix it , i am only end user . hope to see some fixes from you . good luck 👍 |
Provide specific APK, DEX, or file hash
classes.dex.zip
Describe the bug
outputlog.txt
Writing output to classes_simple.dex
Exception in thread "main" java.lang.IllegalStateException: Switch instruction at address/index 0x1c/12 refers to the wrong type of payload instruction.
at org.jf.dexlib2.builder.MutableMethodImplementation.fixInstructions(MutableMethodImplementation.java:386)
at org.jf.dexlib2.builder.MutableMethodImplementation.getTryBlocks(MutableMethodImplementation.java:167)
at org.jf.dexlib2.writer.builder.BuilderClassPool.getTryBlocks(BuilderClassPool.java:307)
at org.jf.dexlib2.writer.builder.BuilderClassPool.getTryBlocks(BuilderClassPool.java:64)
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:1011)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:345)
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:300)
at org.cf.simplify.Launcher.run(Launcher.java:149)
at org.cf.simplify.Main.main(Main.java:14)
To Reproduce
java -jar simplify.jar --max-call-depth 999 --max-address-visits 999 --max-method-visits 999 --ignore-error classes.dex
Attempted work-arounds
You are the work-around sir 😊😎
The text was updated successfully, but these errors were encountered: