You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2023/06/03 21:22:00 UTC

[jira] [Commented] (BCEL-369) org.apache.bcel.verifier.exc.AssertionViolatedException from method return in subroutine

    [ https://issues.apache.org/jira/browse/BCEL-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17729022#comment-17729022 ] 

Gary D. Gregory commented on BCEL-369:
--------------------------------------

Hello [~katherine-hough] 

I added {{org.apache.bcel.verifier.JiraBcel369TestCase}} which passes. Please review this new test in git master.

Can you try git master or a snapshot build from https://repository.apache.org/content/repositories/snapshots/org/apache/bcel/bcel/6.8.0-SNAPSHOT/ ?


> org.apache.bcel.verifier.exc.AssertionViolatedException from method return in subroutine
> ----------------------------------------------------------------------------------------
>
>                 Key: BCEL-369
>                 URL: https://issues.apache.org/jira/browse/BCEL-369
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Verifier
>    Affects Versions: 6.7.0, 6.8.0
>            Reporter: Katherine Hough
>            Priority: Minor
>         Attachments: Test.class
>
>
> 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:
> {code:java}
> class Test {
>     public Test(int i) {
>         try {
>             i++;
>         } finally {
>             if(i == 0) {
>                 return;
>             }
>             int u = 7;
>             u += 9;
>         }
>         i++;
>     }
> }{code}
> Input: See attached file. 
> Output:
> {code:java}
> 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
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)