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

ClassFile API ArrayIndexOutOfBoundsException with certain class files

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 23
    • 22.0.1
    • core-libs
    • None

      Out-of-spec classfiles can trigger an AIOOBE in the ClassFileAPi, as demonstrated with the javap tool:

      javap -v AIOOBE.class
      ..
      java.lang.ArrayIndexOutOfBoundsException: Index 41 out of bounds for length 13
      at java.base/jdk.internal.classfile.impl.CodeImpl.inflateLineNumbers(CodeImpl.java:241)
      at java.base/jdk.internal.classfile.impl.CodeImpl.inflateMetadata(CodeImpl.java:125)
      at java.base/jdk.internal.classfile.impl.CodeImpl.forEachElement(CodeImpl.java:170)
      at java.base/java.lang.classfile.CompoundElement.elementList(CompoundElement.java:94)
      at java.base/java.lang.classfile.CompoundElement.elements(CompoundElement.java:65)
      at java.base/java.lang.classfile.CompoundElement.iterator(CompoundElement.java:74)
      at jdk.jdeps/com.sun.tools.javap.CodeWriter.writeInstrs(CodeWriter.java:97)
      at jdk.jdeps/com.sun.tools.javap.CodeWriter.write(CodeWriter.java:76)

            asotona Adam Sotona
            mschoene Marc Schönefeld
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: