mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8025661: Ill-formed -Xminf and -Xmaxf options values interpreted as 0
Using strtod() instead of atof() when parsing -Xminf and -Xmaxf. Reviewed-by: brutisso, pliden
This commit is contained in:
parent
588c91b042
commit
3e9df3ecf1
2 changed files with 111 additions and 4 deletions
|
@ -2694,8 +2694,9 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
|
|||
FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size);
|
||||
// Xmaxf
|
||||
} else if (match_option(option, "-Xmaxf", &tail)) {
|
||||
int maxf = (int)(atof(tail) * 100);
|
||||
if (maxf < 0 || maxf > 100) {
|
||||
char* err;
|
||||
int maxf = (int)(strtod(tail, &err) * 100);
|
||||
if (*err != '\0' || maxf < 0 || maxf > 100) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
"Bad max heap free percentage size: %s\n",
|
||||
option->optionString);
|
||||
|
@ -2705,8 +2706,9 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
|
|||
}
|
||||
// Xminf
|
||||
} else if (match_option(option, "-Xminf", &tail)) {
|
||||
int minf = (int)(atof(tail) * 100);
|
||||
if (minf < 0 || minf > 100) {
|
||||
char* err;
|
||||
int minf = (int)(strtod(tail, &err) * 100);
|
||||
if (*err != '\0' || minf < 0 || minf > 100) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
"Bad min heap free percentage size: %s\n",
|
||||
option->optionString);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue