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

Chen Liang liach at openjdk.org
Mon May 5 13:41:47 UTC 2025


On Mon, 5 May 2025 13:36:05 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> A fix to throw `OutOfMemoryError`, as done in releases ≤ 23.
>
> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Simplified test slightly.

Looks good. So the problem was when `s1.length() + s2.length()` overflows to be negative, `<< coder` can make it positive and bypass the check in `newLength` - a weird scenario indeed.

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

Marked as reviewed by liach (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25038#pullrequestreview-2814854242


More information about the core-libs-dev mailing list