RFR: 8329623: NegativeArraySizeException encoding large String to UTF-8
Raffaello Giulietti
rgiulietti at openjdk.org
Mon Apr 8 14:34:59 UTC 2024
On Fri, 5 Apr 2024 17:44:38 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> When encoding a vary large string in String.getBytes(StandardCharset.UTF_8) computation of the buffer size may exceed the range of a positive 32-bit Integer.
> If the estimated size for the result byte array is too large, pre-compute the exact buffer size.
> If that exceeds the range, then throw OutOfMemoryError.
Marked as reviewed by rgiulietti (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/18663#pullrequestreview-1986623356
More information about the core-libs-dev
mailing list