On Mon, 10 Aug 2026 12:24:04 GMT, Volkan Yazici <[email protected]> wrote:

>> Liam Miller-Cushon has updated the pull request incrementally with two 
>> additional commits since the last revision:
>> 
>>  - Add OutOfMemoryError checks for UTF-16 encodedLength fast paths
>>  - Copyright years
>
> src/java.base/share/classes/java/lang/String.java line 2159:
> 
>> 2157:             return length() << 1;
>> 2158:         } else if (cs == UTF_16.INSTANCE) {
>> 2159:             return (length() << 1) + 2; // BOM
> 
> These expressions can become negative or wrap. We need to add OOME guards 
> similar to the ones in other paths, e.g., `encodedLengthUTF8_UTF16`. These 
> edge cases should be tested too.

Thanks, fixed and added test coverage for OOME handling for the 
UTF-16/UTF-16LE/UTF-16BE paths.

> src/java.base/share/classes/sun/nio/cs/UTF_16LE.java line 1:
> 
>> 1: /*
> 
> Copyright year needs to be updated.

Done

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32268#discussion_r3749878446
PR Review Comment: https://git.openjdk.org/jdk/pull/32268#discussion_r3749864084

Reply via email to