Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8244573

java.lang.ArrayIndexOutOfBoundsException thrown for malformed class file

    Details

    • Subcomponent:
    • Resolved In Build:
      b26

      Description

      A DESCRIPTION OF THE PROBLEM :
      javap crashes when reading the attached class file with an ArrayIndexOutOfBoundsException. The malformed class file has a method with an empty name in the constant pool. This file was generated automatically by a fuzzer.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Download the attached class file as `A.class`
      2. Call javap: `javap -c A.class`

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Either print an error or print the contents of the class file, including the code in the method.
      ACTUAL -
      Compiled from "A.class"
      public final class example.A extends example.B {
        static volatile a_1.a_1 a_0;

        double ();
          Code:
      Error: A serious internal error has occurred: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
      Please file a bug report, and include the following information:
      java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
              at jdk.jdeps/com.sun.tools.classfile.Instruction.getByte(Instruction.java:173)
              at jdk.jdeps/com.sun.tools.classfile.Instruction.getUnsignedByte(Instruction.java:178)
              at jdk.jdeps/com.sun.tools.classfile.Instruction.getOpcode(Instruction.java:199)
              at jdk.jdeps/com.sun.tools.classfile.Instruction.length(Instruction.java:222)
              at jdk.jdeps/com.sun.tools.classfile.Code_attribute$1.next(Code_attribute.java:117)
              at jdk.jdeps/com.sun.tools.classfile.Code_attribute$1.next(Code_attribute.java:106)
              at jdk.jdeps/com.sun.tools.javap.CodeWriter.writeInstrs(CodeWriter.java:104)
              at jdk.jdeps/com.sun.tools.javap.ClassWriter.writeMethod(ClassWriter.java:591)
              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)


      ---------- BEGIN SOURCE ----------
      This class file was generated by an automatic fuzz testing tool, so there is no source code. The class file is below in Base-64 encoding:

      yv66vgADAC0ADwEAClNvdXJjZUZpbGUBAAdBLmNsYXNzAQAJZXhhbXBsZS9BBwADAQAJZXhhbXBsZS9CBwAFAQADYV8wAQAJTGFfMS9hXzE7AQAAAQADKClEAQAEdGhpcwEAC0xleGFtcGxlL0E7AQASTG9jYWxWYXJpYWJsZVRhYmxlAQAEQ29kZXn/AAQABgAAAAEBSAAHAAgAAAABAAAACQAKAAEADgAAAB4AAAABAAAAAAAAAAEADQAAAAwAAQAAAAAACwAMAAAAAQABAAAAAgAC
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              asotona Adam Sotona
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: