RFR: 8343984: Fix Unsafe address overflow [v3]

Alan Bateman alanb at openjdk.org
Tue Nov 12 09:06:30 UTC 2024


On Tue, 12 Nov 2024 08:59:30 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:
> 
>   from @minborg

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

> 834:         UNSAFE.putByte(val, address    , (byte)(c1));
> 835:         UNSAFE.putByte(val, address + 1, (byte)(c2));
> 836:         UNSAFE.putByte(val, address + 2, (byte)(c3));

While you are here, I wonder if this should be renamed to offset to make it clearer.

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

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


More information about the core-libs-dev mailing list