[jdk8u-dev] RFR: 8159695: Arguments::atojulong() fails to detect overflows

Kazuhisa Takakuri ktakakuri at openjdk.org
Tue Apr 16 14:35:06 UTC 2024


On Thu, 25 Jan 2024 05:57:35 GMT, Kazuhisa Takakuri <ktakakuri at openjdk.org> wrote:

> Hi all, this is a backport of JDK-8159695: Arguments::atojulong() fails to detect overflows.
> The bug reported is reproducible in JDK8, so this patch should be applied.
> The original patch does not apply cleanly, and the following modifications are needed:
> 
> - Lines related to hexadecimal numbers are skipped because support for hexadecimal numbers as a VM option, corresponding to JDK-8042885, was not introduced until JDK9.
> - The accompanying test to check the functionality of the atojulong() function is dropped because it is a GTest, which is not available in JDK8.
> 
> Note that atomull() was renamed to atojulong() in JDK9 as part of the enhancement JDK-8153073, which supports suffixes in memory size options.
> Testing
> 
> - Manually check the behaviour
> When a given value is too large to fit in a julong, the proper exception is raised with this patch.
> 
> without patch
> 
> java -XX:GCDrainStackTargetSize=999999999999999999999999999999 -XX:+PrintFlagsFinal -version | grep StackTarget
> 
>     uintx GCDrainStackTargetSize                   := 18446744073709551615                    {product}
> 
> 
> with patch
> 
> java -XX:GCDrainStackTargetSize=999999999999999999999999999999 -XX:+PrintFlagsFinal -version
> Improperly specified VM option 'GCDrainStackTargetSize=999999999999999999999999999999'
> Error: Could not create the Java Virtual Machine.
> Error: A fatal exception has occurred. Program will exit.
> 
> 
> - hotspot_tier1
> 
> Thank you.

As phohensee has pointed out ,strtoull needs to be declared for Windows-x86. A corresponding fix exists in JDK9, but it's in a different context. I am currently working on backporting this fix in issue #434. Once issue #434 is integrated, the build failure will be resolved and GHA result is fine (see #434).

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

PR Comment: https://git.openjdk.org/jdk8u-dev/pull/428#issuecomment-2059241778


More information about the jdk8u-dev mailing list