Re: RFR: JDK-8320570 NegativeArraySizeException decoding >1G UTF8 bytes with non-ascii characters [v3]
On Wed, 6 Dec 2023 11:47:13 GMT, Jim Laskey wrote: >> A regression is found in Java9+ creating String instance from UTF8 bytes, a >> side effect of string compactation https://openjdk.org/jeps/254 that changed >> the decoding logic. Specifically, when constructing a string from bytes: >> >> ``` >> String str = new String(largeBytes, StandardCharsets.UTF_8); >> ``` >> >> if the size of largeBytes is greater than 2^30 (>1 GB) but smaller than >> INT_MAX (2 GB), it fails on Java9+ (including 11, 17, 21, though the stack >> trace is slightly different, see below), regardless of jvm heap size. In >> Java8, it succeeded when jvm heap size is set to be sufficient. > > Jim Laskey has updated the pull request incrementally with one additional > commit since the last revision: > > Requested changes Looks good, thanks for the updates. - Marked as reviewed by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/16974#pullrequestreview-1767792457
Re: RFR: JDK-8320570 NegativeArraySizeException decoding >1G UTF8 bytes with non-ascii characters [v3]
> A regression is found in Java9+ creating String instance from UTF8 bytes, a > side effect of string compactation https://openjdk.org/jeps/254 that changed > the decoding logic. Specifically, when constructing a string from bytes: > > ``` > String str = new String(largeBytes, StandardCharsets.UTF_8); > ``` > > if the size of largeBytes is greater than 2^30 (>1 GB) but smaller than > INT_MAX (2 GB), it fails on Java9+ (including 11, 17, 21, though the stack > trace is slightly different, see below), regardless of jvm heap size. In > Java8, it succeeded when jvm heap size is set to be sufficient. Jim Laskey has updated the pull request incrementally with one additional commit since the last revision: Requested changes - Changes: - all: https://git.openjdk.org/jdk/pull/16974/files - new: https://git.openjdk.org/jdk/pull/16974/files/ddc7acc2..144b5161 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk=16974=02 - incr: https://webrevs.openjdk.org/?repo=jdk=16974=01-02 Stats: 6 lines in 1 file changed: 5 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/16974.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16974/head:pull/16974 PR: https://git.openjdk.org/jdk/pull/16974