Konloch / bytecode-viewer

A Java 8+ Jar & Android APK Reverse Engineering Suite (Decompiler, Editor, Debugger & More)
https://bytecodeviewer.com
GNU General Public License v3.0
14.73k stars 1.15k forks source link

error after dex2jar - java.lang.StringIndexOutOfBoundsException: #366

Open ilakhater opened 3 years ago

ilakhater commented 3 years ago

The error appears during the dex2jar decompiling of the apk. Then it proceeds to show only partial decompiled code. Some classes are still not showing. Any suggestions?

https://the.bytecode.club - Created by @Konloch - Bytecode Viewer 2.9.22, Fat-Jar: true Start up took 0 seconds I: Using Apktool 2.3.0 on WYhdEGYwnGvNUsjsjfnQzjiPBsTgwUTY.apk I: Loading resource table... I: Decoding AndroidManifest.xml with resources... I: Loading resource table from file: /root/.Bytecode-Viewer/bcv_temp/vehRXjxUsrFA/1.apk I: Regular manifest package... I: Decoding file-resources... S: Could not decode file, replacing by FALSE value: font/gt_eesti_display_regular.ttf S: Could not decode file, replacing by FALSE value: font/gt_eesti_display_bold.ttf S: Could not decode file, replacing by FALSE value: font/gt_eesti_text_regular.ttf S: Could not decode file, replacing by FALSE value: font/gt_eesti_text_bold.ttf I: Decoding values / XMLs... I: Baksmaling classes.dex... I: Baksmaling classes2.dex... I: Baksmaling classes3.dex... I: Baksmaling classes4.dex... I: Copying assets and libs... I: Copying unknown files... I: Copying original files... dex2jar /root/.Bytecode-Viewer/bcv_temp/WYhdEGYwnGvNUsjsjfnQzjiPBsTgwUTY.apk -> ./WYhdEGYwnGvNUsjsjfnQzjiPBsTgwUTY-dex2jar.jar java.lang.StringIndexOutOfBoundsException: begin 1, end -1, length 2 at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319) at java.base/java.lang.String.substring(String.java:1874) at org.a.a.b.a.a(Unknown Source) at org.a.a.b.a.b(Unknown Source) at org.a.a.a.b.mapSignature(Unknown Source) at org.a.a.a.d.visitField(Unknown Source) at org.a.a.f.visitField(Unknown Source) at com.googlecode.d2j.dex.Dex2Asm.convertField(Unknown Source) at com.googlecode.d2j.dex.Dex2Asm.convertClass(Unknown Source) at com.googlecode.d2j.dex.Dex2Asm.convertDex(Unknown Source) at com.googlecode.d2j.dex.Dex2jar.doTranslate(Unknown Source) at com.googlecode.d2j.dex.Dex2jar.to(Unknown Source) at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Unknown Source) at com.googlecode.dex2jar.tools.BaseCmd.doMain(Unknown Source) at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Unknown Source) at the.bytecode.club.bytecodeviewer.util.Dex2Jar.dex2Jar(Dex2Jar.java:54) at the.bytecode.club.bytecodeviewer.BytecodeViewer$8.run(BytecodeViewer.java:957)

ThexXTURBOXx commented 3 years ago

You are using a very old release of BytecodeViewer. Please update to the newest one here: https://github.com/Konloch/bytecode-viewer/suites/4153371319/artifacts/106583116

ilakhater commented 3 years ago

ok, seems to be happening with the newest version as well.

Error Message: Please send this error log to https://github.com/Konloch/bytecode-viewer/issues or Konloch at https://the.bytecode.club or konloch@gmail.com If you hold appropriate legal rights to the relevant class/jar/apk file please include that as well. Bytecode Viewer Version: 2.10.16 [Fat Jar], OS: Linux, Java: 11.0.3

java.lang.StringIndexOutOfBoundsException: String index out of range: 29 at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47) at java.base/java.lang.String.charAt(String.java:693) at org.objectweb.asm.signature.SignatureReader.accept(SignatureReader.java:92) at org.objectweb.asm.commons.Remapper.mapSignature(Remapper.java:209) at org.objectweb.asm.commons.ClassRemapper.visit(ClassRemapper.java:108) at org.objectweb.asm.ClassVisitor.visit(ClassVisitor.java:115) at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:476) at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:428) at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:533) at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:135) at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:235) at the.bytecode.club.bytecodeviewer.util.Dex2Jar.dex2Jar(Dex2Jar.java:42) at the.bytecode.club.bytecodeviewer.resources.importing.impl.APKResourceImporter.open(APKResourceImporter.java:66) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.importKnownFile(ImportResource.java:88) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.run(ImportResource.java:60) at java.base/java.lang.Thread.run(Thread.java:834)

Command line output: Bytecode Viewer 2.10.16 [Fat Jar] - Created by @Konloch https://bytecodeviewer.com - https://the.bytecode.club Start up took 0 seconds Opening.../home/me/projects/yoti/base.apk I: Using Apktool 2.6.0 on FDtUxtPRwNMtCfpRaXJWJRjGFqbtmGSg.apk I: Loading resource table... I: Decoding AndroidManifest.xml with resources... I: Loading resource table from file: /root/.Bytecode-Viewer/bcv_temp/UQgOMiQYLvBm/1.apk I: Regular manifest package... I: Decoding file-resources... I: Decoding values / XMLs... I: Baksmaling classes.dex... I: Baksmaling classes2.dex... I: Baksmaling classes3.dex... I: Baksmaling classes4.dex... I: Copying assets and libs... I: Copying unknown files... I: Copying original files... I: Copying META-INF/services directory com.googlecode.d2j.DexException: Failed to convert code for Lcom/google/android/gms/common/internal/zzh;.zLJ(I[Ljava/lang/Object;)Ljava/lang/Object; at com.googlecode.d2j.dex.ExDex2Asm.convertCode(ExDex2Asm.java:27) at com.googlecode.d2j.dex.Dex2jar$2.convertCode(Dex2jar.java:92) at com.googlecode.d2j.dex.Dex2Asm.convertMethod(Dex2Asm.java:685) at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:517) at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:428) at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:533) at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:135) at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:235) at the.bytecode.club.bytecodeviewer.util.Dex2Jar.dex2Jar(Dex2Jar.java:42) at the.bytecode.club.bytecodeviewer.resources.importing.impl.APKResourceImporter.open(APKResourceImporter.java:66) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.importKnownFile(ImportResource.java:88) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.run(ImportResource.java:60) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.lang.RuntimeException: fail exe unlock a8 at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.exec(BaseAnalyze.java:79) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.exec(BaseAnalyze.java:15) at com.googlecode.dex2jar.ir.ts.Cfg.dfs(Cfg.java:254) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.analyze0(BaseAnalyze.java:62) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.analyze(BaseAnalyze.java:56) at com.googlecode.dex2jar.ir.ts.UnSSATransformer.transform(UnSSATransformer.java:275) at com.googlecode.d2j.dex.Dex2jar$2.optimize(Dex2jar.java:126) at com.googlecode.d2j.dex.Dex2Asm.convertCode(Dex2Asm.java:525) at com.googlecode.d2j.dex.ExDex2Asm.convertCode(ExDex2Asm.java:24) ... 12 more Caused by: java.lang.NullPointerException at com.googlecode.dex2jar.ir.ts.UnSSATransformer$LiveA.onUseLocal(UnSSATransformer.java:550) at com.googlecode.dex2jar.ir.ts.UnSSATransformer$LiveA.onUseLocal(UnSSATransformer.java:363) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.onUse(BaseAnalyze.java:153) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.onUse(BaseAnalyze.java:15) at com.googlecode.dex2jar.ir.ts.Cfg.travel(Cfg.java:336) at com.googlecode.dex2jar.ir.ts.Cfg.travel(Cfg.java:391) at com.googlecode.dex2jar.ir.ts.an.BaseAnalyze.exec(BaseAnalyze.java:77) ... 20 more Applying workaround to field Lcom/google/android/material/appbar/HeaderBehavior$FlingRunnable;#layout with original signature TV by changing its type to java.lang.Object. java.lang.StringIndexOutOfBoundsException: String index out of range: 29 at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47) at java.base/java.lang.String.charAt(String.java:693) at org.objectweb.asm.signature.SignatureReader.accept(SignatureReader.java:92) at org.objectweb.asm.commons.Remapper.mapSignature(Remapper.java:209) at org.objectweb.asm.commons.ClassRemapper.visit(ClassRemapper.java:108) at org.objectweb.asm.ClassVisitor.visit(ClassVisitor.java:115) at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:476) at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:428) at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:533) at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:135) at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:235) at the.bytecode.club.bytecodeviewer.util.Dex2Jar.dex2Jar(Dex2Jar.java:42) at the.bytecode.club.bytecodeviewer.resources.importing.impl.APKResourceImporter.open(APKResourceImporter.java:66) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.importKnownFile(ImportResource.java:88) at the.bytecode.club.bytecodeviewer.resources.importing.ImportResource.run(ImportResource.java:60) at java.base/java.lang.Thread.run(Thread.java:834)

ThexXTURBOXx commented 3 years ago

Thank you very much for reporting back! This error is better to analyze since it also contains the line numbers. I will see what I can do :)

ThexXTURBOXx commented 3 years ago

Could you please test again using this build? https://github.com/Konloch/bytecode-viewer/suites/4387669732/artifacts/115610670 If it still doesn't work: Are you able to share the APK file?