Integrated: 8321514: UTF16 string gets constructed incorrectly from codepoints if CompactStrings is not enabled

Aleksei Voitylov avoitylov at openjdk.org
Thu Dec 14 14:41:49 UTC 2023


On Mon, 11 Dec 2023 13:48:18 GMT, Aleksei Voitylov <avoitylov at openjdk.org> wrote:

> Since JDK-8311906, if CompactStrings is not enabled, index is not considered when calling extractCodepoints from StringUTF16.toBytes(). Because of that the last elements of the source codepoints array are stripped from the resulting UTF16 string, which fires in other places (e.g. during RegEx processing).
>  
> The fix replaces len in extractCodepoints parameters with end that is index + len.

This pull request has now been integrated.

Changeset: fde5b168
Author:    Aleksei Voitylov <avoitylov at openjdk.org>
Committer: Roger Riggs <rriggs at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/fde5b16817c3263236993f2e8c2d2469610d99bd
Stats:     27 lines in 2 files changed: 25 ins; 0 del; 2 mod

8321514: UTF16 string gets constructed incorrectly from codepoints if CompactStrings is not enabled

Co-authored-by: Roger Riggs <rriggs at openjdk.org>
Reviewed-by: rriggs

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

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


More information about the core-libs-dev mailing list