Skip to content

Commit 5128747

Browse files
authored
Merge commit from fork
Fix JSON parser infinite loop on invalid i token
2 parents 162df84 + 574adfe commit 5128747

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/facil/fiobj/fio_json_parser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,12 +453,12 @@ fio_json_parse(json_parser_s *parser, const char *buffer, size_t length) {
453453
long long i = fio_atol((char **)&tmp);
454454
if (tmp > limit)
455455
goto stop;
456-
if (!tmp || JSON_NUMERAL[*tmp]) {
456+
if (!tmp || tmp == pos || JSON_NUMERAL[*tmp]) {
457457
tmp = pos;
458458
double f = fio_atof((char **)&tmp);
459459
if (tmp > limit)
460460
goto stop;
461-
if (!tmp || JSON_NUMERAL[*tmp])
461+
if (!tmp || tmp == pos || JSON_NUMERAL[*tmp])
462462
goto error;
463463
fio_json_on_float(parser, f);
464464
pos = tmp;

0 commit comments

Comments
 (0)