load: Parse a badly put - sign correctly
Thanks to Manolis Delakis for reporting.
This commit is contained in:
parent
f243930b68
commit
d3959a8ce7
@ -418,11 +418,15 @@ static int lex_scan_number(lex_t *lex, char c, json_error_t *error)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else /* c != '0' */ {
|
||||
else if(isdigit(c)) {
|
||||
c = lex_get_save(lex, error);
|
||||
while(isdigit(c))
|
||||
c = lex_get_save(lex, error);
|
||||
}
|
||||
else {
|
||||
lex_unget_unsave(lex, c);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(c != '.' && c != 'E' && c != 'e') {
|
||||
long value;
|
||||
|
17
test/testdata/invalid
vendored
17
test/testdata/invalid
vendored
@ -167,7 +167,22 @@ too big negative integer near '-123123123123123'
|
||||
====
|
||||
1
|
||||
invalid token near 'troo'
|
||||
==== invalid-escap ====
|
||||
==== minus-sign-without-number ====
|
||||
[-foo]
|
||||
====
|
||||
1
|
||||
invalid token near '-'
|
||||
==== invalid-negative-integerr ====
|
||||
[-123foo]
|
||||
====
|
||||
1
|
||||
']' expected near 'foo'
|
||||
==== invalid-negative-real ====
|
||||
[-123.123foo]
|
||||
====
|
||||
1
|
||||
']' expected near 'foo'
|
||||
==== invalid-escape ====
|
||||
["\a <-- invalid escape"]
|
||||
====
|
||||
1
|
||||
|
17
test/testdata/invalid-strip
vendored
17
test/testdata/invalid-strip
vendored
@ -167,7 +167,22 @@ too big negative integer near '-123123123123123'
|
||||
====
|
||||
1
|
||||
invalid token near 'troo'
|
||||
==== invalid-escap ====
|
||||
==== minus-sign-without-number ====
|
||||
[-foo]
|
||||
====
|
||||
1
|
||||
invalid token near '-'
|
||||
==== invalid-negative-integerr ====
|
||||
[-123foo]
|
||||
====
|
||||
1
|
||||
']' expected near 'foo'
|
||||
==== invalid-negative-real ====
|
||||
[-123.123foo]
|
||||
====
|
||||
1
|
||||
']' expected near 'foo'
|
||||
==== invalid-escape ====
|
||||
["\a <-- invalid escape"]
|
||||
====
|
||||
1
|
||||
|
Loading…
Reference in New Issue
Block a user