RFR: 8366421: ModifiedUtf.utfLen may overflow for giant string [v2]
Guanqiang Han
ghan at openjdk.org
Thu Sep 18 12:49:50 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
- add regression test
- Merge remote-tracking branch 'upstream/master' into 8366421
- Change return type of utfLen to long to prevent overflow
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/27285/files
- new: https://git.openjdk.org/jdk/pull/27285/files/0303a278..bc8d7678
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=27285&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=27285&range=00-01
Stats: 9593 lines in 224 files changed: 5049 ins; 1184 del; 3360 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