On Thu, 10 Jul 2025 12:20:45 GMT, Volkan Yazici <vyaz...@openjdk.org> wrote:
>> Volkan Yazici has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Replace casting with `as_Region()` in `generate_string_range_check` > > src/java.base/share/classes/java/lang/StringCoding.java line 150: > >> 148: */ >> 149: static int encodeISOArray(byte[] sa, int sp, byte[] da, int dp, int >> len) { >> 150: checkFromIndexSize(sp, len << 1, requireNonNull(sa, >> "sa").length, AIOOBE_FORMATTER); > > `sa` contains 2-byte `char`s, and `sp` points to an index of this inflated > array. Though, `len` denotes the codepoint count, hence the `len << 1` while > checking `sp` and `len` bounds. The reference of `sa.length` is likely wrong also, as it is the source length in bytes but for the index check should be checking the source length in chars. It might be worth trying to find or create a test for the accidental incorrect interpretation of length in bytes vs chars.. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25998#discussion_r2213528045