ClassFile API ArrayIndexOutOfBoundsException with certain class files

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 23
    • Affects Version/s: 22.0.1
    • Component/s: 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)

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

              Created:
              Updated:
              Resolved: