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

Afshin Zafari azafari at openjdk.org
Mon Jun 9 09:25:00 UTC 2025


On Tue, 13 May 2025 12:54:11 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.
>
> Afshin Zafari has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'origin/master' into _8352140_lshift_klass_hpp
>  - minimum change.
>  - Merge remote-tracking branch 'origin/master' into _8352140_lshift_klass_hpp
>  - 8352140: UBSAN: fix the left shift of negative value in klass.hpp, array_layout_helper()

Withdrawn

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

PR Comment: https://git.openjdk.org/jdk/pull/24184#issuecomment-2955197748


More information about the hotspot-dev mailing list