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

ktakakuri duke at openjdk.org
Thu Jan 25 06:03:42 UTC 2024


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.

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

Commit messages:
 - Backport 992b6c464a9655438a808cf2e1979e04356123be

Changes: https://git.openjdk.org/jdk8u-dev/pull/428/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=428&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8159695
  Stats: 14 lines in 1 file changed: 7 ins; 0 del; 7 mod
  Patch: https://git.openjdk.org/jdk8u-dev/pull/428.diff
  Fetch: git fetch https://git.openjdk.org/jdk8u-dev.git pull/428/head:pull/428

PR: https://git.openjdk.org/jdk8u-dev/pull/428


More information about the jdk8u-dev mailing list