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

ClassFile API ArrayIndexOutOfBoundsException with label metadata

XMLWordPrintable

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

      An out-of-spec class file containing invalid label metadata can cause an ArrayIndexOutOfBoundsException, as seen with the "-c" option of the javap tool.

      ./jdk-23/bin/javap -J--show-version -c CFA_AIOOBE_inflate_labels_javap_minus_c.class
      openjdk 23-ea 2024-09-17
      OpenJDK Runtime Environment (build 23-ea+23-1895)
      OpenJDK 64-Bit Server VM (build 23-ea+23-1895, mixed mode, sharing)
      Compiled from "ValidationErrorHandler.java"
      ....
      Error: A serious internal error has occurred: java.lang.ArrayIndexOutOfBoundsException: Index 2054 out of bounds for length 7
      Please file a bug report, and include the following information:
      java.lang.ArrayIndexOutOfBoundsException: Index 2054 out of bounds for length 7
      at java.base/jdk.internal.classfile.impl.CodeImpl.inflateLabel(CodeImpl.java:224)
      at java.base/jdk.internal.classfile.impl.CodeImpl.generateDebugElements(CodeImpl.java:361)
      at java.base/jdk.internal.classfile.impl.CodeImpl.forEachElement(CodeImpl.java:174)
      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)
      ....

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

              Created:
              Updated:
              Resolved: