RFR: 8318127: align_up has potential overflow [v2]

Casper Norrbin cnorrbin at openjdk.org
Tue Oct 1 13:04:38 UTC 2024


On Tue, 1 Oct 2024 12:59:12 GMT, Casper Norrbin <cnorrbin at openjdk.org> wrote:

>> Hi everyone,
>> 
>> The `align_up` function contained code which could potentially overflow and produce an incorrect result. This PR adds an assert to check for such.
>> 
>> Additionally, two test case that previously caused an overflow have been updated to use the highest possible values that do not trigger an overflow.
>
> Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision:
> 
>   checked/unchecked align functions

Hi all, sorry for the late follow-up.
Based on the discussion, I've now added `align_up_checked` which asserts for overflow, and have reverted `align_up` to its original form.

The next steps would be to go through uses of `align_up` and change to `align_up_checked` as appropriate, but I feel that is out of scope for this fix.

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

PR Comment: https://git.openjdk.org/jdk/pull/20808#issuecomment-2385726224


More information about the hotspot-dev mailing list