Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
6.7.0, 6.8.0
-
None
-
None
Description
Verifier pass 3B fails due to a method return in a subroutine.
There is a comment in the associated code indicating that you are likely already aware of this issue:
"// TODO: This is buggy, we check only the top-level return instructions this way.
// Maybe some maniac returns from a method when in a subroutine?"
The attached class file is what javac for the Java HotSpot SE Development Kit build 1.4.2_19-b04 produced for the program:
class Test { public Test(int i) { try { i++; } finally { if(i == 0) { return; } int u = 7; u += 9; } i++; } }
Input: See attached file.
Output:
Apache Commons BCEL https://commons.apache.org/bcel Now verifying: Test Pass 1: VERIFIED_OK Passed verification. Pass 2: VERIFIED_OK Passed verification. Pass 3a, method number 0 ['public void <init>(int arg1)']: VERIFIED_OK Passed verification. Exception in thread "main" org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL ERROR: Some RuntimeException occurred while verify()ing class 'Test', method 'public void <init>(int arg1)'. Original RuntimeException's stack trace: --- org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL ERROR: outFrame not set! This: 24: return [InstructionContext] ExecutionChain: 24: return [InstructionContext] OutFrames: '{ 7: jsr -> 19 [InstructionContext]=Local Variables: 0: Test 1: int 2: <unknown object> 3: <return address targeting 10: goto[167](3) -> 34> 4: <unknown object> OperandStack: Slots used: 0 MaxStack: 1. , 14: jsr -> 19 [InstructionContext]=Local Variables: 0: Test 1: int 2: java.lang.Throwable 3: <return address targeting 17: aload_2[44](1)> 4: <unknown object> OperandStack: Slots used: 0 MaxStack: 1. }'. at org.apache.bcel.verifier.structurals.ControlFlowGraph$InstructionContextImpl.getOutFrame(ControlFlowGraph.java:285) at org.apache.bcel.verifier.structurals.Pass3bVerifier.circulationPump(Pass3bVerifier.java:275) at org.apache.bcel.verifier.structurals.Pass3bVerifier.do_verify(Pass3bVerifier.java:386) at org.apache.bcel.verifier.PassVerifier.verify(PassVerifier.java:98) at org.apache.bcel.verifier.Verifier.doPass3b(Verifier.java:166) at org.apache.bcel.verifier.Verifier.verifyType(Verifier.java:90) at org.apache.bcel.verifier.Verifier.main(Verifier.java:69) --- at org.apache.bcel.verifier.structurals.Pass3bVerifier.do_verify(Pass3bVerifier.java:398) at org.apache.bcel.verifier.PassVerifier.verify(PassVerifier.java:98) at org.apache.bcel.verifier.Verifier.doPass3b(Verifier.java:166) at org.apache.bcel.verifier.Verifier.verifyType(Verifier.java:90) at org.apache.bcel.verifier.Verifier.main(Verifier.java:69) Caused by: org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL ERROR: outFrame not set! This: 24: return [InstructionContext] ExecutionChain: 24: return [InstructionContext] OutFrames: '{ 7: jsr -> 19 [InstructionContext]=Local Variables: 0: Test 1: int 2: <unknown object> 3: <return address targeting 10: goto[167](3) -> 34> 4: <unknown object> OperandStack: Slots used: 0 MaxStack: 1. , 14: jsr -> 19 [InstructionContext]=Local Variables: 0: Test 1: int 2: java.lang.Throwable 3: <return address targeting 17: aload_2[44](1)> 4: <unknown object> OperandStack: Slots used: 0 MaxStack: 1. }'. at org.apache.bcel.verifier.structurals.ControlFlowGraph$InstructionContextImpl.getOutFrame(ControlFlowGraph.java:285) at org.apache.bcel.verifier.structurals.Pass3bVerifier.circulationPump(Pass3bVerifier.java:275) at org.apache.bcel.verifier.structurals.Pass3bVerifier.do_verify(Pass3bVerifier.java:386) ... 4 more