Skip to content
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

Issue with dex2jar: Index -1 out of bounds for length 0 #38

Open
mbv opened this issue May 29, 2023 · 2 comments
Open

Issue with dex2jar: Index -1 out of bounds for length 0 #38

mbv opened this issue May 29, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mbv
Copy link

mbv commented May 29, 2023

dex2jar ../app.apk -> ./app-dex2jar.jar
ASM fail to generate .class file: iko/lxf
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
	at org.objectweb.asm.Frame.getConcreteOutputType(Frame.java:1140)
	at org.objectweb.asm.Frame.merge(Frame.java:1185)
	at org.objectweb.asm.CurrentFrame.execute(CurrentFrame.java:53)
	at org.objectweb.asm.MethodWriter.visitVarInsn(MethodWriter.java:927)
	at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2409)
	at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1514)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:744)
	at org.objectweb.asm.ClassWriter.replaceAsmInstructions(ClassWriter.java:777)
	at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:740)
	at com.googlecode.d2j.dex.Dex2jar$1$1.visitEnd(Dex2jar.java:71)
	at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:555)
	at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:449)
	at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:614)
	at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:153)
	at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:253)
	at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:103)
	at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:297)
	at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:16)
ASM fail to generate .class file: iko/oxf
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
	at org.objectweb.asm.Frame.getConcreteOutputType(Frame.java:1140)
	at org.objectweb.asm.Frame.merge(Frame.java:1185)
	at org.objectweb.asm.CurrentFrame.execute(CurrentFrame.java:53)
	at org.objectweb.asm.MethodWriter.visitVarInsn(MethodWriter.java:927)
	at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2409)
	at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1514)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:744)
	at org.objectweb.asm.ClassWriter.replaceAsmInstructions(ClassWriter.java:777)
	at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:740)
	at com.googlecode.d2j.dex.Dex2jar$1$1.visitEnd(Dex2jar.java:71)
	at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:555)
	at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:449)
	at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:614)
	at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:153)
	at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:253)
	at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:103)
	at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:297)
	at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:16)
Detail Error Information in File ./app-error.zip

app-error.zip

will send apk to email

@ThexXTURBOXx
Copy link
Owner

Thank you very much, I have also received your email with the APK. I will take a look at it soon

@ThexXTURBOXx ThexXTURBOXx added the bug Something isn't working label Jul 30, 2024
@Rabbit0w0
Copy link

Rabbit0w0 commented Oct 21, 2024

This issue is basically caused by problems calculating frames. We can simply changes the flags passed to ClassWriter.
We convert the dex to jar files not for running on Hotspot JVM (for sure), so frames aren't of necessity. Disabling the COMPUTE_FRAMES flag is ok to fix this.
I think the dex2jar has an existing config system. You just need to disable the corresponding flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants