Fix parsing of "-Infinity" when the "-" and "Infinity" are split across multiple calls.

Add several additional test cases for partial parsing of infinity values.
This commit is contained in:
Eric Haszlakiewicz
2017-11-27 00:04:33 -05:00
parent 4d1e0b4409
commit 48f7e389fb
2 changed files with 35 additions and 1 deletions

View File

@@ -763,7 +763,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
printbuf_memappend_fast(tok->pb, case_start, case_len);
// Check for -Infinity
if (tok->pb->buf[0] == '-' && case_len == 1 &&
if (tok->pb->buf[0] == '-' && case_len <= 1 &&
(c == 'i' || c == 'I'))
{
state = json_tokener_state_inf;