mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8332400: isspace argument should be a valid unsigned char
Reviewed-by: dholmes, amitkumar, stuefe, jwaters
This commit is contained in:
parent
9b0a5c5cd0
commit
cc64aeac47
8 changed files with 17 additions and 17 deletions
|
@ -661,7 +661,7 @@ bool CgroupController::read_numerical_key_value(const char* filename, const char
|
||||||
for (; line != nullptr; line = fgets(buf, buf_len, fp)) {
|
for (; line != nullptr; line = fgets(buf, buf_len, fp)) {
|
||||||
char after_key = line[key_len];
|
char after_key = line[key_len];
|
||||||
if (strncmp(line, key, key_len) == 0
|
if (strncmp(line, key, key_len) == 0
|
||||||
&& isspace(after_key) != 0
|
&& isspace((unsigned char) after_key) != 0
|
||||||
&& after_key != '\n') {
|
&& after_key != '\n') {
|
||||||
// Skip key, skip space
|
// Skip key, skip space
|
||||||
const char* value_substr = line + key_len + 1;
|
const char* value_substr = line + key_len + 1;
|
||||||
|
|
|
@ -1356,7 +1356,7 @@ void os::Linux::capture_initial_stack(size_t max_size) {
|
||||||
i = 0;
|
i = 0;
|
||||||
if (s) {
|
if (s) {
|
||||||
// Skip blank chars
|
// Skip blank chars
|
||||||
do { s++; } while (s && isspace(*s));
|
do { s++; } while (s && isspace((unsigned char) *s));
|
||||||
|
|
||||||
#define _UFM UINTX_FORMAT
|
#define _UFM UINTX_FORMAT
|
||||||
#define _DFM INTX_FORMAT
|
#define _DFM INTX_FORMAT
|
||||||
|
@ -5222,7 +5222,7 @@ static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
|
||||||
if (s == nullptr) return -1;
|
if (s == nullptr) return -1;
|
||||||
|
|
||||||
// Skip blank chars
|
// Skip blank chars
|
||||||
do { s++; } while (s && isspace(*s));
|
do { s++; } while (s && isspace((unsigned char) *s));
|
||||||
|
|
||||||
count = sscanf(s,"%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu",
|
count = sscanf(s,"%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu",
|
||||||
&cdummy, &idummy, &idummy, &idummy, &idummy, &idummy,
|
&cdummy, &idummy, &idummy, &idummy, &idummy, &idummy,
|
||||||
|
|
|
@ -748,7 +748,7 @@ static bool set_bool_flag(JVMFlag* flag, bool value, JVMFlagOrigin origin) {
|
||||||
|
|
||||||
static bool set_fp_numeric_flag(JVMFlag* flag, const char* value, JVMFlagOrigin origin) {
|
static bool set_fp_numeric_flag(JVMFlag* flag, const char* value, JVMFlagOrigin origin) {
|
||||||
// strtod allows leading whitespace, but our flag format does not.
|
// strtod allows leading whitespace, but our flag format does not.
|
||||||
if (*value == '\0' || isspace(*value)) {
|
if (*value == '\0' || isspace((unsigned char) *value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
char* end;
|
char* end;
|
||||||
|
@ -1178,13 +1178,13 @@ bool Arguments::process_settings_file(const char* file_name, bool should_exist,
|
||||||
if (c == '\n') in_comment = false;
|
if (c == '\n') in_comment = false;
|
||||||
} else {
|
} else {
|
||||||
if (c == '#') in_comment = true;
|
if (c == '#') in_comment = true;
|
||||||
else if (!isspace(c)) {
|
else if (!isspace((unsigned char) c)) {
|
||||||
in_white_space = false;
|
in_white_space = false;
|
||||||
token[pos++] = checked_cast<char>(c);
|
token[pos++] = checked_cast<char>(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (c == '\n' || (!in_quote && isspace(c))) {
|
if (c == '\n' || (!in_quote && isspace((unsigned char) c))) {
|
||||||
// token ends at newline, or at unquoted whitespace
|
// token ends at newline, or at unquoted whitespace
|
||||||
// this allows a way to include spaces in string-valued options
|
// this allows a way to include spaces in string-valued options
|
||||||
token[pos] = '\0';
|
token[pos] = '\0';
|
||||||
|
@ -3141,7 +3141,7 @@ jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_
|
||||||
// parse all options
|
// parse all options
|
||||||
while (rd < buffer_end) {
|
while (rd < buffer_end) {
|
||||||
// skip leading white space from the input string
|
// skip leading white space from the input string
|
||||||
while (rd < buffer_end && isspace(*rd)) {
|
while (rd < buffer_end && isspace((unsigned char) *rd)) {
|
||||||
rd++;
|
rd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3154,7 +3154,7 @@ jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_
|
||||||
|
|
||||||
// Tokens are strings of non white space characters separated
|
// Tokens are strings of non white space characters separated
|
||||||
// by one or more white spaces.
|
// by one or more white spaces.
|
||||||
while (rd < buffer_end && !isspace(*rd)) {
|
while (rd < buffer_end && !isspace((unsigned char) *rd)) {
|
||||||
if (*rd == '\'' || *rd == '"') { // handle a quoted string
|
if (*rd == '\'' || *rd == '"') { // handle a quoted string
|
||||||
int quote = *rd; // matching quote to look for
|
int quote = *rd; // matching quote to look for
|
||||||
rd++; // don't copy open quote
|
rd++; // don't copy open quote
|
||||||
|
|
|
@ -45,7 +45,7 @@ CmdLine::CmdLine(const char* line, size_t len, bool no_command_name)
|
||||||
line_end = &line[len];
|
line_end = &line[len];
|
||||||
|
|
||||||
// Skip whitespace in the beginning of the line.
|
// Skip whitespace in the beginning of the line.
|
||||||
while (_cmd < line_end && isspace((int) _cmd[0])) {
|
while (_cmd < line_end && isspace((unsigned char) _cmd[0])) {
|
||||||
_cmd++;
|
_cmd++;
|
||||||
}
|
}
|
||||||
cmd_end = _cmd;
|
cmd_end = _cmd;
|
||||||
|
@ -55,7 +55,7 @@ CmdLine::CmdLine(const char* line, size_t len, bool no_command_name)
|
||||||
_cmd_len = 0;
|
_cmd_len = 0;
|
||||||
} else {
|
} else {
|
||||||
// Look for end of the command name
|
// Look for end of the command name
|
||||||
while (cmd_end < line_end && !isspace((int) cmd_end[0])) {
|
while (cmd_end < line_end && !isspace((unsigned char) cmd_end[0])) {
|
||||||
cmd_end++;
|
cmd_end++;
|
||||||
}
|
}
|
||||||
_cmd_len = cmd_end - _cmd;
|
_cmd_len = cmd_end - _cmd;
|
||||||
|
|
|
@ -501,7 +501,7 @@ static jboolean expand(JLI_List args, const char *str, const char *var_name) {
|
||||||
// This is retained until the process terminates as it is saved as the args
|
// This is retained until the process terminates as it is saved as the args
|
||||||
p = JLI_MemAlloc(JLI_StrLen(str) + 1);
|
p = JLI_MemAlloc(JLI_StrLen(str) + 1);
|
||||||
while (*str != '\0') {
|
while (*str != '\0') {
|
||||||
while (*str != '\0' && isspace(*str)) {
|
while (*str != '\0' && isspace((unsigned char) *str)) {
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ static jboolean expand(JLI_List args, const char *str, const char *var_name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
arg = p;
|
arg = p;
|
||||||
while (*str != '\0' && !isspace(*str)) {
|
while (*str != '\0' && !isspace((unsigned char) *str)) {
|
||||||
if (inEnvVar && (*str == '"' || *str == '\'')) {
|
if (inEnvVar && (*str == '"' || *str == '\'')) {
|
||||||
quote = *str++;
|
quote = *str++;
|
||||||
while (*str != quote && *str != '\0') {
|
while (*str != quote && *str != '\0') {
|
||||||
|
@ -577,7 +577,7 @@ static jboolean expand(JLI_List args, const char *str, const char *var_name) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (*str == '\0' || isspace(*str));
|
assert (*str == '\0' || isspace((unsigned char) *str));
|
||||||
}
|
}
|
||||||
|
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
|
|
|
@ -242,7 +242,7 @@ static bool process_doesnt_exist(pid_t pid) {
|
||||||
found_state = true;
|
found_state = true;
|
||||||
state = buf + state_len;
|
state = buf + state_len;
|
||||||
// Skip the spaces
|
// Skip the spaces
|
||||||
while (isspace(*state)) {
|
while (isspace((unsigned char) *state)) {
|
||||||
state++;
|
state++;
|
||||||
}
|
}
|
||||||
// A state value of 'X' indicates that the thread is dead. 'Z'
|
// A state value of 'X' indicates that the thread is dead. 'Z'
|
||||||
|
|
|
@ -35,14 +35,14 @@
|
||||||
#include "error_messages.h"
|
#include "error_messages.h"
|
||||||
|
|
||||||
static char *skipWhitespace(char *p) {
|
static char *skipWhitespace(char *p) {
|
||||||
while ((*p != '\0') && isspace(*p)) {
|
while ((*p != '\0') && isspace((unsigned char) *p)) {
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *skipNonWhitespace(char *p) {
|
static char *skipNonWhitespace(char *p) {
|
||||||
while ((*p != '\0') && !isspace(*p)) {
|
while ((*p != '\0') && !isspace((unsigned char) *p)) {
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
|
|
|
@ -72,7 +72,7 @@ std::string makeMessage(const std::runtime_error& e, const SourceCodePos& pos) {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool isNotSpace(int chr) {
|
bool isNotSpace(int chr) {
|
||||||
return isspace(chr) == 0;
|
return isspace((unsigned char) chr) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue