RFR: 8343984: Fix Unsafe address overflow [v5]
Per Minborg
pminborg at openjdk.org
Tue Nov 12 12:20:10 UTC 2024
On Tue, 12 Nov 2024 11:24:24 GMT, Shaojin Wen <swen at openjdk.org> wrote:
>> In the JDK code, there are some places that may cause Unsafe offset overflow. The probability of occurrence is low, but if it occurs, it will cause JVM crash.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>
> rename address to offset, from @AlanBateman
> I want to add such a test case, but I am worried that it will consume too many resources during the build process.
>
> ```java
> /**
> * @test
> * @bug 8343984
> * @summary Test that the append capacity is close to Integer.MaxValue
> * @run main/othervm -Xms6g -Xmx6g HugeAppend
> */
>
> public final class HugeAppend {
> public static void main(String[] args) {
> StringBuilder buf = new StringBuilder();
> int loop4 = Integer.MAX_VALUE / 4;
> for (int i = 0; i < loop4; i++) {
> buf.append(true);
> }
>
> buf.setLength(0);
> int loop5 = Integer.MAX_VALUE / 5;
> for (int i = 0; i < loop5; i++) {
> buf.append(false);
> }
> }
> }
> ```
Yeah. I think it is reasonable to leave out such tests.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22027#issuecomment-2470383131
More information about the core-libs-dev
mailing list