RFR: 8344026: Ubsan: prevent potential integer overflow in c1_LIRGenerator_<arch>.cpp file [v5]

Andrew Haley aph at openjdk.org
Fri Nov 22 10:37:31 UTC 2024


On Fri, 22 Nov 2024 05:12:55 GMT, Amit Kumar <amitkumar at openjdk.org> wrote:

>> This PR converts datatype from `jint` to `juint` for contstant `c` check in c1_LIRGenerator_<arch>.cpp. Please look JBS for more info.
>
> Amit Kumar has updated the pull request incrementally with four additional commits since the last revision:
> 
>  - reduce diff size
>  - arm changes
>  - aarch64 changes
>  - s390x changes

src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp line 282:

> 280: 
> 281:   if (is_power_of_2((juint)c - 1)) {
> 282:     __ shift_left(left, exact_log2((juint)c - 1), tmp);

Please convert `c` to unsigned at the beginning. Then do not use `c` any more.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22144#discussion_r1853702699


More information about the hotspot-compiler-dev mailing list