RFR: 8356152: String.concat can throw StringIndexOutOfBoundsException [v5]
Claes Redestad
redestad at openjdk.org
Tue May 6 10:09:13 UTC 2025
On Tue, 6 May 2025 08:44:56 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:
>> @ForceInline
>> static int checkOverflow(int value) {
>> if (value >= 0) {
>> return value;
>> }
>> throw new OutOfMemoryError("Overflow: String length out of range");
>> }
>>
>> private static long checkOverflow(long lengthCoder) {
>> if ((int)lengthCoder >= 0) {
>> return lengthCoder;
>> }
>> throw new OutOfMemoryError("Overflow: String length out of range");
>> }
>>
>> @cl4es There are two checkOverflow methods
>
> Exactly. The one used here is the (int) variant.
D'oh, missed that it's been added since it's not co-located in the source. Sorry for the noise!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25038#discussion_r2075147358
More information about the core-libs-dev
mailing list