You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Peter Burka (JIRA)" <ji...@apache.org> on 2017/06/09 17:31:18 UTC

[jira] [Created] (BCEL-291) Verifier rejects invokevirtual on array

Peter Burka created BCEL-291:
--------------------------------

             Summary: Verifier rejects invokevirtual on array
                 Key: BCEL-291
                 URL: https://issues.apache.org/jira/browse/BCEL-291
             Project: Commons BCEL
          Issue Type: Bug
    Affects Versions: 6.0
            Reporter: Peter Burka


If a Java program invokes a java.lang.Object method on a variable whose static type is an array, the methodref associated with the invokevirtual will refer to an array class.

When the BCEL verifier encounters such a class, it fails with a ClassGenException.

Test case:
{noformat}
public class Bug1 {
    public static Object[] bug(Object[] arg) {
	return arg.clone();
    }
}
{noformat}

Outoput:
{noformat}
JustIce by Enver Haase, (C) 2001-2002.
<http://bcel.sourceforge.net>
<http://commons.apache.org/bcel>

Now verifying: Bug1

Pass 1:
VERIFIED_OK
Passed verification.

Pass 2:
VERIFIED_OK
Passed verification.

Pass 3a, method number 0 ['public void <init>()']:
VERIFIED_OK
Passed verification.

Pass 3b, method number 0 ['public void <init>()']:
VERIFIED_OK
Passed verification.

Exception in thread "main" org.apache.bcel.generic.ClassGenException: [Ljava/lang/Object; does not represent an ObjectType
	at org.apache.bcel.generic.FieldOrMethod.getLoadClassType(FieldOrMethod.java:137)
	at org.apache.bcel.verifier.statics.Pass3aVerifier$InstOperandConstraintVisitor.visitLoadClass(Pass3aVerifier.java:521)
	at org.apache.bcel.generic.INVOKEVIRTUAL.accept(INVOKEVIRTUAL.java:85)
	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)
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)