RFR: 8353468: [ubsan] arguments.cpp:2422:23: runtime error: 2.14748e+11 is outside the range of representable values of type 'int' [v3]

David Holmes dholmes at openjdk.org
Thu Aug 28 12:51:44 UTC 2025


On Thu, 28 Aug 2025 07:58:41 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> This is exactly the source of confusion. User is allowed to enter `double` values in range `[0.0, 1.0]`, but the value is multiplied by 100 and stored in a `uintx`.
>> Using hard-coded constants `MinHeapFreeRatio ` and `MaxHeapFreeRatio` in the error message is as expected by tests.
>> These two flags have already constraint functions as `MinHeapFreeRatioConstraintFunc` and `MaxHeapFreeRatioConstraintFunc` where minf <= maxf is checked.
>> Checking the user input to be in [0.0, 1.0] cannot be done in the constraint functions, since the original input is missed due to * 100 and casting to uintx.
>
> I agree with David's comment here. The suggestion is to explicitly pre-check that Xminf/Xmaxf falls within [0.0, 1.0], just so that the constraint functions for MinHeapFreeRatio and MaxHeapFreeRatio *don't* trigger and give confusing messages. [edited]

Exactly. The way these flags are currently handled is a mess. Given how they are used to set the other flags they need to be pre-checked for validity before being used by the other constraint function - because as you note by then it is too late as we already did the multiplcation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26859#discussion_r2307316555


More information about the hotspot-runtime-dev mailing list