reject negative after whitespace in json_parse_uint64

This commit is contained in:
Javid Khan
2026-08-17 20:37:45 +05:30
parent 81092b3072
commit 510d68bd35
3 changed files with 13 additions and 1 deletions
+5
View File
@@ -145,6 +145,11 @@ int main(int argc, char **argv)
strcpy(buf, "-9223372036854775808");
checkit_uint(buf);
// A negative value hidden behind non-space whitespace must still be
// rejected; strtoull() skips this whitespace and would wrap the '-'.
strcpy(buf, "\t-1");
checkit_uint(buf);
strcpy(buf, " 1");
checkit_uint(buf);
+1
View File
@@ -41,6 +41,7 @@ buf=1 parseit=0, value=1
buf=2147483647 parseit=0, value=2147483647
buf=-1 parseit=1, value=666
buf=-9223372036854775808 parseit=1, value=666
buf= -1 parseit=1, value=666
buf= 1 parseit=0, value=1
buf=00001234 parseit=0, value=1234
buf=0001234x parseit=0, value=1234