On Tue, 12 Nov 2024 08:26:44 GMT, Shaojin Wen <[email protected]> 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:
>
> revert, from @minborg
It would be good to add some tests to ensure `long` precision is used.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
line 1006:
> 1004: }
> 1005:
> 1006: private void writeBooleanArray(TypeArray array, int length) throws
> IOException {
Note that the copyright year needs updating.
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java
line 4104:
> 4102: @ForceInline
> 4103: static long byteArrayAddress(byte[] a, int index) {
> 4104: return (long) Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
These classes are generated via the `X-Vector.java.template` in the
`java.incubator.vector` package. So, you only need to change one file here.

-------------
PR Comment: https://git.openjdk.org/jdk/pull/22027#issuecomment-2469916847
PR Review Comment: https://git.openjdk.org/jdk/pull/22027#discussion_r1837687593
PR Review Comment: https://git.openjdk.org/jdk/pull/22027#discussion_r1837685399