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 Gregory (JIRA)" <ji...@apache.org> on 2019/07/06 15:14:00 UTC

[jira] [Commented] (BCEL-307) ClassFormatException thrown in Pass 3A verification

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

Gary Gregory commented on BCEL-307:
-----------------------------------

The {{A}} class file you provided is not in a Java package, therefore I cannot add it along with all of your other classes with the exact same unpackaged class name :( to our {{src/test/resources}} folder.

It would be great if you could provide class files in a package named after _something_ like jqf_0, jqf_1, and son on. This would allow us to add these files as {{src/test/resources/jqf_0/Hello.class}}, {{src/test/resources/jqf_1/A.class}}, and so on.

> ClassFormatException thrown in Pass 3A verification
> ---------------------------------------------------
>
>                 Key: BCEL-307
>                 URL: https://issues.apache.org/jira/browse/BCEL-307
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Verifier
>    Affects Versions: 6.2
>            Reporter: Rohan Padhye
>            Priority: Major
>         Attachments: A.class
>
>
> The verifier throws a ClassFormatException during Pass 3A verification of a malformed class file even though Pass 1 and Pass 2 have completed successfully.
> Note that the input class file is indeed malformed, however the verifier should ideally just return a verification result of REJECTED instead of throwing an unchecked run-time exception.
> h1. Steps to reproduce:
>  
> Save the attached file as "example/A.class" and run:
> java -cp <classpath> org.apache.bcel.verifier.Verifier example.A
>  
> The file A.class was generated automatically by the fuzzer JQF ([https://github.com/rohanpadhye/jqf]).
> h2. Expected output:
> VERIFIED_REJECTED
> h2. Observed output:
> JustIce by Enver Haase, (C) 2001-2002.
> <http://bcel.sourceforge.net>
> <http://commons.apache.org/bcel>
>  
> Now verifying: example.A
>  
> Pass 1:
> VERIFIED_OK
> Passed verification.
>  
> Pass 2:
> VERIFIED_OK
> Passed verification.
>  
> Exception in thread "main" org.apache.bcel.classfile.ClassFormatException: Expected class `CONSTANT_InvokeDynamic' at index 14 and got CONSTANT_Methodref[10](class_index = 13, name_and_type_index = 11)
>  at org.apache.bcel.classfile.ConstantPool.getConstant(ConstantPool.java:261)
>  at org.apache.bcel.classfile.ConstantPool.constantToString(ConstantPool.java:207)
>  at org.apache.bcel.classfile.Utility.codeToString(Utility.java:373)
>  at org.apache.bcel.classfile.Utility.codeToString(Utility.java:157)
>  at org.apache.bcel.classfile.Code.toString(Code.java:306)
>  at org.apache.bcel.classfile.Code.toString(Code.java:328)
>  at java.lang.String.valueOf(String.java:2994)
>  at java.lang.StringBuilder.append(StringBuilder.java:131)
>  at org.apache.bcel.verifier.statics.Pass3aVerifier.delayedPass2Checks(Pass3aVerifier.java:289)
>  at org.apache.bcel.verifier.statics.Pass3aVerifier.do_verify(Pass3aVerifier.java:200)
>  at org.apache.bcel.verifier.PassVerifier.verify(PassVerifier.java:71)
>  at org.apache.bcel.verifier.Verifier.doPass3a(Verifier.java:89)
>  at org.apache.bcel.verifier.Verifier.main(Verifier.java:216)
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)