Narrows template ascii routines to prevent a possible signed overflow in generic code. (#5232)

This commit is contained in:
Vladimir Glavnyy
2019-03-12 00:26:28 +07:00
committed by Wouter van Oortmerssen
parent 73a648b685
commit 407fb5d537
2 changed files with 10 additions and 10 deletions

View File

@@ -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);
}
}