ThexXTURBOXx / dex2jar

Tools to work with android .dex and java .class files
Apache License 2.0
234 stars 59 forks source link

Fix inheritance issue in InvokePolymorphicExpr causing ClassCastException #7

Closed nick-botticelli closed 3 years ago

nick-botticelli commented 3 years ago

NewTransformer#findInvokeExpr attempts to cast InvokePolymorphicExpr to InvokeExpr under certain inputs, which causes a ClassCastException. It appears that InvokePolymorphicExpr was meant to extend InvokeExpr for this reason?

I wonder if there may be other classes like InvokeCustomExpr that should be switched over to extend InvokeExpr

Fixes pxb1988/dex2jar#311. I experienced the same issue when attempting to use dex2jar against classes3.dex from framework.jar from official Android S emulator. Also realized I mixed up the commit name so I can redo and fix this pull request if needed.

Before:

Before

After:

After
ThexXTURBOXx commented 3 years ago

Thank you very much for your work! This LGTM. I even made the InvokeCustomExpr extend InvokeExpr now as you said. I belive this really is the correct way of handling that bug... And I can run dex2jar on the framework.jar successfully now. Please check if it still also works for you :)

ThexXTURBOXx commented 3 years ago

I'm just going to merge this and see if I get some bug reports regarding this. Thank you very much for your contribution and the hints! :)

nick-botticelli commented 3 years ago

I'm just going to merge this and see if I get some bug reports regarding this. Thank you very much for your contribution and the hints! :)

Sorry for not getting back to you earlier. I just tested your commit and it still seems to function as intended. Thank you for merging!

ThexXTURBOXx commented 3 years ago

Perfect, thanks for reporting back! :)