[jdk21u-dev] RFR: 8320570: NegativeArraySizeException decoding >1G UTF8 bytes with non-ascii characters
Paul Hohensee
phh at openjdk.org
Mon Mar 11 22:23:13 UTC 2024
On Fri, 8 Mar 2024 21:39:07 GMT, Amos Shi <ashi at openjdk.org> wrote:
> Backport of [JDK-8320570](https://bugs.openjdk.org/browse/JDK-8320570)
> - `NegativeSize.java` - Clean backport
> - `String.java` - only 1 line change is unclean, the rest are clean. Details as bellow.
> - This PR contains 2 commits
> - The commit 1: is a clean backport part
> - The commit 2: is a manual fix of the following 1 line:
> - In the `jdk master` branch, the variable name is `utf16`
> - Well in `jdk21u-dev`, the varialbe name is `buf`
> - So we manully applied the following line
>
>
> @@ -592,7 +592,7 @@
> this.coder = LATIN1;
> return;
> }
> - byte[] utf16 = new byte[length << 1];
> + byte[] utf16 = StringUTF16.newBytesFor(length);
> StringLatin1.inflate(latin1, 0, utf16, 0, dp);
> dp = decodeUTF8_UTF16(latin1, sp, length, utf16, dp, true);
> if (dp != length) {
>
>
>
> - So this PR can be considered as `semantics clean`
>
>
> Testing
> - Local: Passed on MacOS M1 laptop
> - `test/jdk/java/lang/String/CompactString/NegativeSize.java` - Test results: passed: 1
> - Pipeline:
> - Testing Machine:
This PR duplicates https://github.com/openjdk/jdk21u-dev/pull/332. Please close it.
-------------
PR Comment: https://git.openjdk.org/jdk21u-dev/pull/344#issuecomment-1989547268
More information about the jdk-updates-dev
mailing list