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

Crash while loading Jar #449

Open
xtexChooser opened this issue May 4, 2022 · 4 comments
Open

Crash while loading Jar #449

xtexChooser opened this issue May 4, 2022 · 4 comments

Comments

@xtexChooser
Copy link
Contributor

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
	at java.base/java.lang.String.charAt(String.java:1512)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:200)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassDefEntry.<init>(ClassDefEntry.java:35)
	at cuchaz.enigma.translation.representation.entry.ClassDefEntry.parse(ClassDefEntry.java:57)
	at cuchaz.enigma.analysis.index.IndexClassVisitor.visit(IndexClassVisitor.java:21)
	at org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:371)
	at cuchaz.enigma.analysis.index.JarIndex.indexJar(JarIndex.java:68)
	at cuchaz.enigma.Enigma.openJar(Enigma.java:65)
	at cuchaz.enigma.gui.GuiController.lambda$openJar$1(GuiController.java:105)
	at cuchaz.enigma.gui.dialog.ProgressDialog.lambda$runOffThread$1(ProgressDialog.java:97)
	at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

File: https://anonfiles.com/dcn9V7c9yf/Android_8.8.88.7830_jar
Converted by dex2jar from QQ

Enigma 2.1.0

@xtexChooser
Copy link
Contributor Author

I tryed to set a breakpoint using Arthas and I got such a report:

[arthas@11392]$ watch cuchaz.enigma.translation.representation.entry.ClassEntry getOuterClass params -e
Press Q or Ctrl+C to abort.
Affect(class count: 2 , method count: 2) cost in 140 ms, listenerId: 4
method=cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass location=AtExceptionExit
ts=2022-05-04 15:33:41; [cost=0.0787ms] result=@Object[][
    @String[],
]
method=cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass location=AtExceptionExit
ts=2022-05-04 15:33:41; [cost=2.1547ms] result=@Object[][
    @String[$r8],
]
method=cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass location=AtExceptionExit
ts=2022-05-04 15:33:41; [cost=2.7951ms] result=@Object[][
    @String[$r8$backportedMethods],
]
method=cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass location=AtExceptionExit
ts=2022-05-04 15:33:41; [cost=4.9083ms] result=@Object[][
    @String[$r8$backportedMethods$utility],
]
method=cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass location=AtExceptionExit
ts=2022-05-04 15:33:41; [cost=6.0708ms] result=@Object[][
    @String[$r8$backportedMethods$utility$Long],
]
method=cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass location=AtExceptionExit
ts=2022-05-04 15:33:41; [cost=6.7612ms] result=@Object[][
    @String[$r8$backportedMethods$utility$Long$1],
]
method=cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass location=AtExceptionExit
ts=2022-05-04 15:33:41; [cost=7.1624ms] result=@Object[][
    @String[$r8$backportedMethods$utility$Long$1$hashCode],
]

In the JAR, I found that there are only these classes:
image

But there is no parent class for $r8, so this makes Enigma crash.

@xtexChooser
Copy link
Contributor Author

I think classes starts with $ should be proceeded as parent class directly.

@xtexChooser
Copy link
Contributor Author

By the way, cuchaz.enigma.analysis.index.IndexReferenceVisitor.lambda$visitMethod$0 crashed, too.

java.lang.RuntimeException: org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 17: String index out of range: 0
	at cuchaz.enigma.analysis.index.IndexReferenceVisitor.lambda$visitMethod$0(IndexReferenceVisitor.java:48)
	at cuchaz.enigma.analysis.MethodNodeWithAction.visitEnd(MethodNodeWithAction.java:17)
	at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:770)
	at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:647)
	at org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:451)
	at cuchaz.enigma.analysis.index.JarIndex.indexJar(JarIndex.java:74)
	at cuchaz.enigma.Enigma.openJar(Enigma.java:65)
	at cuchaz.enigma.gui.GuiController.lambda$openJar$1(GuiController.java:105)
	at cuchaz.enigma.gui.dialog.ProgressDialog.lambda$runOffThread$1(ProgressDialog.java:97)
	at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 17: String index out of range: 0
	at org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:296)
	at cuchaz.enigma.analysis.index.IndexReferenceVisitor.lambda$visitMethod$0(IndexReferenceVisitor.java:46)
	... 15 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
	at java.base/java.lang.String.charAt(String.java:1512)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:200)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.getOuterClass(ClassEntry.java:206)
	at cuchaz.enigma.translation.representation.entry.ClassEntry.<init>(ClassEntry.java:32)
	at cuchaz.enigma.translation.representation.entry.MethodEntry.parse(MethodEntry.java:44)
	at cuchaz.enigma.analysis.index.IndexReferenceVisitor$MethodInterpreter.naryOperation(IndexReferenceVisitor.java:109)
	at cuchaz.enigma.analysis.index.IndexReferenceVisitor$MethodInterpreter.naryOperation(IndexReferenceVisitor.java:53)
	at org.objectweb.asm.tree.analysis.Frame.executeInvokeInsn(Frame.java:684)
	at org.objectweb.asm.tree.analysis.Frame.execute(Frame.java:609)
	at org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:188)
	... 16 more

[arthas@11392]$ watch cuchaz.enigma.analysis.index.IndexReferenceVisitor lambda$visitMethod$0 params -e
Press Q or Ctrl+C to abort.
Affect(class count: 1 , method count: 1) cost in 192 ms, listenerId: 5
method=cuchaz.enigma.analysis.index.IndexReferenceVisitor.lambda$visitMethod$0 location=AtExceptionExit
ts=2022-05-04 15:42:24; [cost=0.1755ms] result=@Object[][
    @MethodDefEntry[com/tencent/videocut/utils/lyric/Sentence.hashCode()I],
    @MethodNodeWithAction[cuchaz.enigma.analysis.MethodNodeWithAction@4fb9eb2b],
]

@xtexChooser
Copy link
Contributor Author

A quick arthas command to find out which class caused crashed: watch org.objectweb.asm.tree.ClassNode accept target.name -e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant