You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Neidhart (Jira)" <ji...@apache.org> on 2020/02/13 12:31:00 UTC
[jira] [Commented] (BCEL-310) ArrayIndexOutOfBounds in Verifier
Pass 3A
[ https://issues.apache.org/jira/browse/BCEL-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17036180#comment-17036180 ]
Thomas Neidhart commented on BCEL-310:
--------------------------------------
Running javap on the class file produces this output:
{code}
public Hello();
descriptor: ()V
flags: (0x0001) ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
Error: A serious internal error has occurred: java.lang.NullPointerException
Please file a bug report, and include the following information:
java.lang.NullPointerException
at jdk.jdeps/com.sun.tools.javap.CodeWriter$1.visitArrayType(CodeWriter.java:138)
at jdk.jdeps/com.sun.tools.javap.CodeWriter$1.visitArrayType(CodeWriter.java:131)
at jdk.jdeps/com.sun.tools.classfile.Instruction.accept(Instruction.java:258)
at jdk.jdeps/com.sun.tools.javap.CodeWriter.writeInstr(CodeWriter.java:126)
at jdk.jdeps/com.sun.tools.javap.CodeWriter.writeInstrs(CodeWriter.java:108)
at jdk.jdeps/com.sun.tools.javap.CodeWriter.write(CodeWriter.java:75)
at jdk.jdeps/com.sun.tools.javap.AttributeWriter.visitCode(AttributeWriter.java:235)
at jdk.jdeps/com.sun.tools.javap.AttributeWriter.visitCode(AttributeWriter.java:87)
at jdk.jdeps/com.sun.tools.classfile.Code_attribute.accept(Code_attribute.java:102)
at jdk.jdeps/com.sun.tools.javap.AttributeWriter.write(AttributeWriter.java:112)
at jdk.jdeps/com.sun.tools.javap.ClassWriter.writeMethod(ClassWriter.java:587)
at jdk.jdeps/com.sun.tools.javap.ClassWriter.writeMethods(ClassWriter.java:471)
at jdk.jdeps/com.sun.tools.javap.ClassWriter.write(ClassWriter.java:269)
at jdk.jdeps/com.sun.tools.javap.JavapTask.write(JavapTask.java:836)
at jdk.jdeps/com.sun.tools.javap.JavapTask.writeClass(JavapTask.java:655)
at jdk.jdeps/com.sun.tools.javap.JavapTask.run(JavapTask.java:600)
at jdk.jdeps/com.sun.tools.javap.JavapTask.run(JavapTask.java:450)
at jdk.jdeps/com.sun.tools.javap.Main.main(Main.java:47)
{code}
which is an indication that the class file is not well-formed.
> ArrayIndexOutOfBounds in Verifier Pass 3A
> -----------------------------------------
>
> Key: BCEL-310
> URL: https://issues.apache.org/jira/browse/BCEL-310
> Project: Commons BCEL
> Issue Type: Bug
> Components: Verifier
> Affects Versions: 6.2
> Reporter: Rohan Padhye
> Priority: Major
> Attachments: Hello.class
>
>
> Verifier throws OOB on malformed input instead of reporting verification failure.
> h1. Steps to reproduce:
>
> Save the attached file as "Hello.class" and run:
> java -cp <classpath> org.apache.bcel.verifier.Verifier Hello
>
> The file Hello.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: Hello
>
> Pass 1:
> VERIFIED_OK
> Passed verification.
>
> Pass 2:
> VERIFIED_OK
> Passed verification.
>
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -73
> at org.apache.bcel.Const.getTypeName(Const.java:1799)
> at org.apache.bcel.generic.NEWARRAY.toString(NEWARRAY.java:90)
> at org.apache.bcel.generic.Instruction.toString(Instruction.java:101)
> at java.lang.String.valueOf(String.java:2994)
> at java.lang.StringBuilder.append(StringBuilder.java:131)
> at org.apache.bcel.verifier.statics.Pass3aVerifier$InstOperandConstraintVisitor.constraintViolated(Pass3aVerifier.java:499)
> at org.apache.bcel.verifier.statics.Pass3aVerifier$InstOperandConstraintVisitor.visitNEWARRAY(Pass3aVerifier.java:835)
> at org.apache.bcel.generic.NEWARRAY.accept(NEWARRAY.java:125)
> 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:8
--
This message was sent by Atlassian Jira
(v8.3.4#803005)