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

Guanqiang Han ghan at openjdk.org
Sun Sep 21 00:18:59 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 and rename TestUtfLen.java to ModifiedUtfTest.java
  
  rename test

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/27285/files
  - new: https://git.openjdk.org/jdk/pull/27285/files/931507aa..4611bbbb

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

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 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