-
Notifications
You must be signed in to change notification settings - Fork 200
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
Gracefully handle dex file decompilation errors, skip problematic dex #173
Conversation
…dex files Some protectors/packers intentionally add useless/unwanted dex files under apk to hinder tools like apktool/apkeditor to fail during decompilation as they're not correct pure dex files(classes0.dex, there's no such thing as `classes0` in an apk file, generally dex files start with `classes.dex`, `classes2.dex` and so on..) which leads to the tools being not able to complete apk decompilation. This commit enhances the `SmaliDecompiler` to gracefully handle errors encountered during the decompilation of individual dex files. Previously, encountering a malformed or invalid dex file would halt the entire decompilation process. Upon encountering an error, instead of halting, it now logs the error and skips the problematic dex file, continuing the decompilation process with the other files.
We could think about adding a flag for this in the decompile options, it might give more flexibility. For now, I stuck with the simpler solution since it works without adding complexity. P.S.: Another reason being naming stuff is hard! :haha: I couldn't settle on a good name for the flag. |
Edit: Okay that was wrong assumption, built baksmali from source and verified on the same file on which APKEditor throws P.S: Consider merging PR with squash & merge to avoid wrong commit going to HEAD :) |
Thank you, |
Check this commit |
Awesome, that will suffice as well. |
Some protectors/packers intentionally add useless/unwanted dex files under apk to hinder tools like apktool/apkeditor to fail during decompilation as they're not correct pure dex files(classes0.dex, there's no such thing as
classes0
in an apk file, generally dex files start withclasses.dex
,classes2.dex
and so on..) which leads to the tools being not able to complete apk decompilation.This commit enhances the
SmaliDecompiler
to gracefully handle errors encountered during the decompilation of individual dex files. Previously, encountering a malformed or invalid dex file would halt the entire decompilation process.Upon encountering an error, instead of halting, it now logs the error and skips the problematic dex file, continuing the decompilation process with the other files.
After: