RFR: 8366421: ModifiedUtf.utfLen may overflow for giant string [v3]

Guanqiang Han ghan at openjdk.org
Sat Sep 20 08:02:53 UTC 2025


> Please review this patch.
> 
> **Description:**
> 
> Currently, ModifiedUtf.utfLen returns a signed int. For very large strings, this may overflow and produce negative values, leading to incorrect behavior in code that relies on the UTF length. This patch changes the return type to long, which fully resolves the issue and allows safe handling of giant strings.
> 
> **Test:**
> 
> GHA

Guanqiang Han has updated the pull request incrementally with one additional commit since the last revision:

  Update TestUtfLen.java
  
  update regression test

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/27285/files
  - new: https://git.openjdk.org/jdk/pull/27285/files/bc8d7678..e6122ec8

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27285&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27285&range=01-02

  Stats: 64 lines in 1 file changed: 40 ins; 0 del; 24 mod
  Patch: https://git.openjdk.org/jdk/pull/27285.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27285/head:pull/27285

PR: https://git.openjdk.org/jdk/pull/27285


More information about the core-libs-dev mailing list