RFR: 8343984: Fix Unsafe address overflow [v7]

Andrey Turbanov aturbanov at openjdk.org
Tue Nov 12 19:24:40 UTC 2024


On Tue, 12 Nov 2024 16:30:12 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:
> 
>   fix copyright

src/java.base/share/classes/java/lang/StringLatin1.java line 833:

> 831:         assert index >= 0 && index + 3 < length(val) : "Trusted caller missed bounds check";
> 832:         // Don't use the putChar method, Its instrinsic will cause C2 unable to combining values into larger stores.
> 833:         long offset  = (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;

Suggestion:

        long offset = (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22027#discussion_r1838642848


More information about the serviceability-dev mailing list