mirror of
https://github.com/json-c/json-c.git
synced 2026-09-07 08:36:50 +08:00
reject negative after whitespace in json_parse_uint64
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user