Integrated: 8366421: ModifiedUtf.utfLen may overflow for giant string

Guanqiang Han ghan at openjdk.org
Wed Sep 24 14:14:09 UTC 2025


On Mon, 15 Sep 2025 07:32:13 GMT, Guanqiang Han <ghan at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: 735afd93
Author:    Guanqiang Han <ghan at openjdk.org>
Committer: Chen Liang <liach at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/735afd93bbdd63d53dc4cec0ac970026ac95cc64
Stats:     174 lines in 5 files changed: 155 ins; 3 del; 16 mod

8366421: ModifiedUtf.utfLen may overflow for giant string

Reviewed-by: liach, rriggs

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

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


More information about the core-libs-dev mailing list