RFR: 8356152: String.concat can throw StringIndexOutOfBoundsException [v3]

Raffaello Giulietti rgiulietti at openjdk.org
Mon May 5 14:38:06 UTC 2025


On Mon, 5 May 2025 14:23:11 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

>> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Added '@requires' to test.
>
> test/jdk/java/lang/String/concat/HugeConcatTest.java line 38:
> 
>> 36: import static org.junit.Assert.assertThrows;
>> 37: 
>> 38: public class HugeConcatTest {
> 
> The same issue is reproduced with simple `+` concatenation.
> 
>         String r1 = "-".repeat(Integer.MAX_VALUE - 10);
>         String r2 = "ы".repeat((Integer.MAX_VALUE - 10)  / 2);
>         System.out.println(r1 + r2);
> 
> I think it makes sense to add related test for it too.

@turbanoff I addressed your note.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25038#discussion_r2073576074


More information about the core-libs-dev mailing list