skylot / jadx

Dex to Java decompiler
Apache License 2.0
41.55k stars 4.87k forks source link

[core] Decompilation of methods failing in v1.2.0 (but working in v1.1.0) - Text search #1064

Open raulsiles opened 3 years ago

raulsiles commented 3 years ago

Checks before report I have verified this issue still occurs in the latest unstable build: jadx-1.2.0-b1456-3bbb6b10.zip.

Describe error I'm analysing an APK (I prefer not to share it publicly. Please, send me a request by e-mail to get it (or give me your e-mail address) and let me know your preferred exchange method to sent it privately to you) that allows, via the "Navigation - Text search" functionality, to search for specific public native methods via the "public native" search term:

See attached images:

bad_search good_search

I can also provide the initial warning messages generated in the console from where jadx-gui has been launched for both, v1.1.0 (almost none) and v1.2.0 (lots of them) when processing this APK at start time.

It seems the issue is related with the decompilation process failing in v1.2.0 for the "net.sqlcipher.database.SQLiteDatabase" class, and specifically the "private void openDatabaseInternal(final byte[] bArr, SQLiteDatabaseHook sQLiteDatabaseHook)" method (that can be decompiled properly in v1.1.0).

See attached images:

bad_decompilation_method good_decompilation_method
skylot commented 3 years ago

@raulsiles thank you for report! Actually these two issues are not related.

First one caused by issue in access modifiers fixing. For example: key(byte[]) method was incorrectly changed to public because it is used in class which was inlined in same class later. This need to be fixed. As a workaround you can disable access modifiers fixing by enabling Respect bytecode access modifiers in preferences.

Second case is a known regression in code restructure algorithm (failed finally extraction).

raulsiles commented 3 years ago

Thanks for the clarifications @skylot.

For the first case, I can confirm the issue is fixed by enabling Respect bytecode access modifiers in preferences, as suggested :)

I have double checked the 2nd case is still present in the latest build from Jan 15, 2020: jadx-1.2.0-b1479-a3ea5145.