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

Afshin Zafari azafari at openjdk.org
Tue May 13 12:54:11 UTC 2025


> 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()

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24184/files
  - new: https://git.openjdk.org/jdk/pull/24184/files/5b17d732..7091db88

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24184&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24184&range=01-02

  Stats: 57173 lines in 1654 files changed: 38233 ins; 10427 del; 8513 mod
  Patch: https://git.openjdk.org/jdk/pull/24184.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24184/head:pull/24184

PR: https://git.openjdk.org/jdk/pull/24184


More information about the hotspot-dev mailing list