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 2018/06/26 05:24:00 UTC

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

Rohan Padhye created BCEL-303:
---------------------------------

             Summary: 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
         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
(v7.6.3#76005)