You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Rohan Padhye (Jira)" <ji...@apache.org> on 2019/09/25 16:00:00 UTC

[jira] [Commented] (BCEL-303) AssertionViolatedException in Pass 3A Verification of invoke instructions

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

Rohan Padhye commented on BCEL-303:
-----------------------------------

The class files attached with this bug report and similar ones that I submitted (BCEL-303, BCEL-307, BCEL-308, BCEL-309, BCEL-310, BCEL-311, BCEL-312, BCEL-313) are all automatically generated by a fuzzer. I do not have corresponding source to compile with package names. Do you know of a tool for editing the bytecode directly to add a package name? Thanks.

Otherwise, I would suggest not including all these test cases in the same classpath, but instead having the tests use a temporary class loader to load these package-less classes from a given directory.

> AssertionViolatedException in Pass 3A Verification of invoke instructions
> -------------------------------------------------------------------------
>
>                 Key: BCEL-303
>                 URL: https://issues.apache.org/jira/browse/BCEL-303
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Verifier
>    Affects Versions: 6.2
>            Reporter: Rohan Padhye
>            Priority: Major
>         Attachments: A.class
>
>
> The verifier throws an assertion violation / INTERNAL ERROR in pass 3A when verifying a malformed class file.
> As I understand it, the issue is that if class A implements interface B, then class A can be pass stage 1 verification even if class B is not resolved. However, pass 3A verification of code that invokes a method defined on class A assumes that the receiver type and all its interfaces are fully resolved.
> 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.verifier.exc.AssertionViolatedException: INTERNAL ERROR: Missing class: java.lang.ClassNotFoundException: Exception while looking for class example.I0: java.io.IOException: Couldn't find: example/I0.class
>  at org.apache.bcel.verifier.statics.Pass3aVerifier$InstOperandConstraintVisitor.visitINVOKEVIRTUAL(Pass3aVerifier.java:1315)
>  at org.apache.bcel.generic.INVOKEVIRTUAL.accept(INVOKEVIRTUAL.java:89)
>  at org.apache.bcel.generic.InstructionHandle.accept(InstructionHandle.java:302)
>  at org.apache.bcel.verifier.statics.Pass3aVerifier.pass3StaticInstructionOperandsChecks(Pass3aVerifier.java:443)
>  at org.apache.bcel.verifier.statics.Pass3aVerifier.do_verify(Pass3aVerifier.java:208)
>  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)
> Caused by: java.lang.ClassNotFoundException: Exception while looking for class example.I0: java.io.IOException: Couldn't find: example/I0.class
>  at org.apache.bcel.util.MemorySensitiveClassPathRepository.loadClass(MemorySensitiveClassPathRepository.java:97)
>  at org.apache.bcel.classfile.JavaClass.getInterfaces(JavaClass.java:847)
>  at org.apache.bcel.verifier.statics.Pass3aVerifier$InstOperandConstraintVisitor.getMethodRecursive(Pass3aVerifier.java:1181)
>  at org.apache.bcel.verifier.statics.Pass3aVerifier$InstOperandConstraintVisitor.visitINVOKEVIRTUAL(Pass3aVerifier.java:1304)
>  ... 7 more
> Caused by: java.io.IOException: Couldn't find: example/I0.class
>  at org.apache.bcel.util.ClassPath.getClassFile(ClassPath.java:279)
>  at org.apache.bcel.util.ClassPath.getInputStream(ClassPath.java:209)
>  at org.apache.bcel.util.ClassPath.getInputStream(ClassPath.java:188)
>  at org.apache.bcel.util.MemorySensitiveClassPathRepository.loadClass(MemorySensitiveClassPathRepository.java:95)
>  ... 10 more
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)