RFR: 8352140: UBSAN: fix the left shift of negative value in klass.hpp, array_layout_helper()

Kim Barrett kbarrett at openjdk.org
Wed Apr 23 10:24:47 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.

Changes requested by kbarrett (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/24184#pullrequestreview-2786787053


More information about the hotspot-dev mailing list