[
https://issues.apache.org/jira/browse/BCEL-184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14351175#comment-14351175
]
Emmanuel Bourg commented on BCEL-184:
-------------------------------------
For the reference, here is the output of the java verifier on the test class
(using {{java -verify}}):
{code}
Exception in thread "main" java.lang.VerifyError: Method expects a return value
Exception Details:
Location:
org/apache/bcel/verifier/tests/TestReturn01.foo()V @8: areturn
Reason:
Type 'java/lang/Object' (current frame, stack[0]) is not assignable to top
(from method signature)
Current Frame:
bci: @8
flags: { }
locals: { }
stack: { 'java/lang/Object' }
Bytecode:
0x0000000: bb00 0359 b700 0800 b0
{code}
> JustIce verifier does not check correctly the returned value of a method
> ------------------------------------------------------------------------
>
> Key: BCEL-184
> URL: https://issues.apache.org/jira/browse/BCEL-184
> Project: Commons BCEL
> Issue Type: Bug
> Components: Verifier
> Affects Versions: 5.2, 6.0
> Reporter: Jérôme Leroux
> Attachments: BCEL-184.patch, BCEL-184.zip
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Defining a {{areturn}} opcode (return object) in a void method is accepted by
> the bytecode verifier.
> This must not be allowed.
> Here is an example of a non-valid bytecode for a void method:
> {code}
> BB 0003 // 0 : new java/lang/Object
> 59 // 3 : dup
> B7 0008 // 4 : invokespecial java/lang/Object.<init>()V
> 00 // 7 : nop
> B0 // 8 : areturn (Not allowed in a void method)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)