RFR: 8352140: UBSAN: fix the left shift of negative value in klass.hpp, array_layout_helper()
David Holmes
dholmes at openjdk.org
Tue Mar 25 05:14:06 UTC 2025
On Mon, 24 Mar 2025 09:52:43 GMT, Afshin Zafari <azafari at openjdk.org> wrote:
> The `array_layout_helper()` with `jint tag` as its first arg, is called with a `tag` whose sign-bit is always set and considered as negative. This negative value is UB in left-shift operation. Changing the type to `juint` fixes this.
>
> Tests:
> linux-x64-debug tier1 with UBSAN enabled.
That will fix it, but I can't help wonder whether `tag` is mis-typed in that function. In general that code seems very confused about signed vs unsigned and j(u)int versus (u)int. ??
-------------
PR Review: https://git.openjdk.org/jdk/pull/24184#pullrequestreview-2712394853
More information about the hotspot-dev
mailing list