RFR: 8366421: ModifiedUtf.utfLen may overflow for giant string [v4]
Guanqiang Han
ghan at openjdk.org
Sat Sep 20 16:05:01 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 two additional commits since the last revision:
- Update TestUtfLen.java
fix format error
- Update TestUtfLen.java
Optimize regression test
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/27285/files
- new: https://git.openjdk.org/jdk/pull/27285/files/e6122ec8..51d57c60
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=27285&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=27285&range=02-03
Stats: 60 lines in 1 file changed: 50 ins; 6 del; 4 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