[
https://jira.jboss.org/jira/browse/JASSIST-80?page=com.atlassian.jira.plu...
]
Shigeru Chiba commented on JASSIST-80:
--------------------------------------
The attached files are only .class files before/after the instrumentation.
Could you show us a Java program that transformed the class file (maybe by Javassist)?
It is really hard to see fix this bug without knowing how you modified the class file.
If it is difficult to show that Java program, telling us the overview of that program is
also helpful.
Thank you!
Editing MethodCall produces incorrect byte code |
java.lang.VerifyError: Illegal target of jump or branch | invalid instruction
-------------------------------------------------------------------------------------------------------------------------------
Key: JASSIST-80
URL:
https://jira.jboss.org/jira/browse/JASSIST-80
Project: Javassist
Issue Type: Bug
Affects Versions: 3.10.0.GA
Environment: $ java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)
Reporter: Martin Burger
Assignee: Shigeru Chiba
Attachments: TokenStream.java, TokenStream_instrumented.class,
TokenStream_instrumented.dump, TokenStream_original.class
Note: Most likely this issue is related to JASSIST-79.
I instrument method calls in a class called org.mozilla.javascript.TokenStream.
If I run (or, load) this class, a java.lang.VerifyError will be thrown:
Exception in thread "main" java.lang.VerifyError: (class:
org/mozilla/javascript/TokenStream, method: getToken$JINSI_4etOXffNDXVw signature: ()I)
Illegal target of jump or branch
It seems Javassist introduces a defective goto statement at position 33217 in method
getToken$JINSI_4etOXffNDXVw:
33217 goto 465
The corresponding Java code (excerpt):
case '-':
if (matchChar('=')) {
this.op = SUB;
c = ASSIGN;
} else if (matchChar('-')) {
if (0 == (flags & TSF_DIRTYLINE)) {
// treat HTML end-comment after possible whitespace
// after line start as comment-utill-eol
if (matchChar('>')) {
skipLine();
continue retry;
}
}
c = DEC;
} else {
c = SUB;
}
flags |= TSF_DIRTYLINE;
return c;
I think the continue statement is related to this defect.
JAD fails to decompile the instrumented class:
ERROR: invalid instruction at 33217 in the method getToken$JINSI_4etOXffNDXVw. The method
will be decompiled incorrectly.
Javassist's framedump fails, too:
Exception in thread "main" java.lang.RuntimeException:
javassist.bytecode.BadBytecode: Stack is empty[pos = 465]
at javassist.bytecode.analysis.FramePrinter.print(FramePrinter.java:89)
at javassist.bytecode.analysis.FramePrinter.print(FramePrinter.java:60)
at javassist.bytecode.analysis.FramePrinter.print(FramePrinter.java:51)
at javassist.tools.framedump.main(framedump.java:45)
Caused by: javassist.bytecode.BadBytecode: Stack is empty[pos = 465]
at javassist.bytecode.analysis.Analyzer.analyzeNextEntry(Analyzer.java:179)
at javassist.bytecode.analysis.Analyzer.analyze(Analyzer.java:143)
at javassist.bytecode.analysis.FramePrinter.print(FramePrinter.java:87)
... 3 more
Caused by: java.lang.IndexOutOfBoundsException: Stack is empty
at javassist.bytecode.analysis.Frame.pop(Frame.java:130)
at javassist.bytecode.analysis.Executor.simplePop(Executor.java:970)
at javassist.bytecode.analysis.Executor.evalStore(Executor.java:869)
at javassist.bytecode.analysis.Executor.execute(Executor.java:188)
at javassist.bytecode.analysis.Analyzer.analyzeNextEntry(Analyzer.java:177)
... 5 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira