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

Move Utf8Entry length validation earlier

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P4 P4
    • 26
    • core-libs
    • None

      Summary

      Note that Signature and nominal descriptors may carry over-java.lang.classfile.constantpool.Utf8Entry limit strings, and prevent the construction of unwritableUtf8Entry`.

      Problem

      java.lang.classfile.constantpool.Utf8Entry can be constructed with oversized String instances that cannot be encoded in the class file format. Such errors are reported only when class files are written, which allows invalid instances to float around in the runtime, which makes such failures hard to track.

      Related to this issue is that java.lang.constant nominal descriptors and java.lang.classfile.(Class|Method|)Signature may be constructed with oversized string representations.

      Solution

      Reject oversized Strings used to construct Utf8Entry, so they now fail immediately with an IllegalArgumentException.

      Reject using oversized nominal descriptor or signature for constructing Utf8Entry. Warn of such risks on the nominal descriptors and signature modeling classes.

      Specification

      See the attached specification diff.

            liach Chen Liang
            liach Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: