On Fri, 5 Apr 2024 17:44:38 GMT, Roger Riggs <rri...@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. This pull request has now been integrated. Changeset: 212a2536 Author: Roger Riggs <rri...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/212a253697b1a5e722bb90ae1140c91175fc028b Stats: 78 lines in 2 files changed: 76 ins; 0 del; 2 mod 8329623: NegativeArraySizeException encoding large String to UTF-8 Reviewed-by: naoto, rgiulietti ------------- PR: https://git.openjdk.org/jdk/pull/18663