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

ModifiedUtf.utfLen may overflow for giant string

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P5 P5
    • tbd
    • None
    • core-libs
    • None

      Currently, ModifiedUtf.utfLen returns a signed int. For giant strings, this may overflow and produce negative values, causing incorrect behavior in code that depends on the UTF length.

      Changing the return type to long would fully solve the problem or keep the return type as int to preserve API compatibility and add explicit overflow checks at call sites (e.g., writeUTFInternal) to safely handle giant strings.

            ghan Guanqiang Han
            ghan Guanqiang Han
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: