mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-04 04:33:23 +00:00
Narrows template ascii routines to prevent a possible signed overflow in generic code. (#5232)
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
73a648b685
commit
407fb5d537
@@ -374,7 +374,7 @@ CheckedError Parser::Next() {
|
||||
"illegal Unicode sequence (unpaired high surrogate)");
|
||||
}
|
||||
// reset if non-printable
|
||||
attr_is_trivial_ascii_string_ &= check_in_range(*cursor_, ' ', '~');
|
||||
attr_is_trivial_ascii_string_ &= check_ascii_range(*cursor_, ' ', '~');
|
||||
|
||||
attribute_ += *cursor_++;
|
||||
}
|
||||
@@ -476,7 +476,7 @@ CheckedError Parser::Next() {
|
||||
}
|
||||
std::string ch;
|
||||
ch = c;
|
||||
if (false == check_in_range(c, ' ', '~')) ch = "code: " + NumToString(c);
|
||||
if (false == check_ascii_range(c, ' ', '~')) ch = "code: " + NumToString(c);
|
||||
return Error("illegal character: " + ch);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user