RFR: 8356865: C2: Unreasonable values for debug flag FastAllocateSizeLimit can lead to left-shift-overflow, which is UB [v3]

Benoît Maillard bmaillard at openjdk.org
Fri Jun 20 16:39:51 UTC 2025


> This PR adds a range constraint for the `-XX:FastAllocateSizeLimit` debug flag. This prevents undefined behavior caused by left-shift overflow of the flag value in `GraphKit::new_array`.
> 
> ### Testing
> - [x] [GitHub Actions](https://github.com/benoitmaillard/jdk/actions?query=branch%3AJDK-8356865)
> - [x] tier1-3, plus some internal testing
> - [x] Manual testing with values known to previously cause undefined behavior
> 
> Thanks!

Benoît Maillard has updated the pull request incrementally with one additional commit since the last revision:

  8356865: Change assert

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25834/files
  - new: https://git.openjdk.org/jdk/pull/25834/files/c8904a29..97f52b45

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

  Stats: 3 lines in 1 file changed: 2 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/25834.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25834/head:pull/25834

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


More information about the hotspot-dev mailing list