-
Bug
-
Resolution: Fixed
-
P4
-
22
-
b24
SonarCloud reports a problem in new code added by JDK-8317683.
parseEnumValueAsUintx can return "true" without initializing the "value", at which point we pass uninitialized value to register_command.
Here:
```
} else if (type == OptionType::Uintx) {
uintx value;
// Is it a named enum?
bool success = parseEnumValueAsUintx(option, line, value, bytes_read, errorbuf, buf_size);
if (!success) {
// Is it a raw number?
success = (sscanf(line, "" UINTX_FORMAT "%n", &value, &bytes_read) == 1);
}
if (success) {
total_bytes_read += bytes_read;
line += bytes_read;
register_command(matcher, option, value); <--- value can be not initialized
return;
} else {
jio_snprintf(errorbuf, buf_size, "Value cannot be read for option '%s' of type '%s'", ccname, type_str);
}
```
parseEnumValueAsUintx can return "true" without initializing the "value", at which point we pass uninitialized value to register_command.
Here:
```
} else if (type == OptionType::Uintx) {
uintx value;
// Is it a named enum?
bool success = parseEnumValueAsUintx(option, line, value, bytes_read, errorbuf, buf_size);
if (!success) {
// Is it a raw number?
success = (sscanf(line, "" UINTX_FORMAT "%n", &value, &bytes_read) == 1);
}
if (success) {
total_bytes_read += bytes_read;
line += bytes_read;
register_command(matcher, option, value); <--- value can be not initialized
return;
} else {
jio_snprintf(errorbuf, buf_size, "Value cannot be read for option '%s' of type '%s'", ccname, type_str);
}
```
- relates to
-
JDK-8317683 Add JIT memory statistics
- Resolved