Skip to content

Commit 7a74a99

Browse files
author
Tim Aitken
committed
add upper-bounds check for valid hex characters
1 parent 157b166 commit 7a74a99

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib_json/json_reader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,11 +1692,11 @@ bool OurReader::decodeHexadecimal(Token& token, Value& decoded) {
16921692
return addError("Token too long to be unsigned integer.", token, current);
16931693
for (; current < token.end_; ++current) {
16941694
Char c = *current;
1695-
if (c >= 'a')
1695+
if (c >= 'a' && c <= 'f')
16961696
c -= 'a' - 10;
1697-
else if (c >= 'A')
1697+
else if (c >= 'A' && c <= 'F')
16981698
c -= 'A' - 10;
1699-
else if (c >= '0')
1699+
else if (c >= '0' && c <= '9')
17001700
c -= '0';
17011701
else
17021702
return addError("Contains non-hexadecimal digits.", token, current);

0 commit comments

Comments
 (0)