ModifiedUtf.utfLen may overflow for giant string

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P5
    • 26
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • b17

      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.

            Assignee:
            Guanqiang Han
            Reporter:
            Guanqiang Han
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: