aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2016-03-18 00:24:33 +0100
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2016-03-18 00:26:15 +0100
commitc90886096a4530562f22ba9708c2a6caef14cde1 (patch)
tree0b8ad3ce2814dc5ae0ad5381b32f7139a9e49bc3 /test
parent921f4b0a6e0c77f8c1d0f48b72d7087a21f5e311 (diff)
Fixing json parsing issues detected by libfuzz.
Diffstat (limited to 'test')
-rw-r--r--test/core/json/json_test.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/core/json/json_test.c b/test/core/json/json_test.c
index 5add80d753..035265a6be 100644
--- a/test/core/json/json_test.c
+++ b/test/core/json/json_test.c
@@ -64,6 +64,7 @@ static testing_pair testing_pairs[] = {
/* Testing UTF-8 character "𝄞", U+11D1E. */
{"\"\xf0\x9d\x84\x9e\"", "\"\\ud834\\udd1e\""},
{"\"\\ud834\\udd1e\"", "\"\\ud834\\udd1e\""},
+ {"{\"\\ud834\\udd1e\":0}", "{\"\\ud834\\udd1e\":0}"},
/* Testing nested empty containers. */
{
" [ [ ] , { } , [ ] ] ", "[[],{},[]]",
@@ -85,20 +86,31 @@ static testing_pair testing_pairs[] = {
/* Testing plain invalid things, exercising the state machine. */
{"\\", NULL},
{"nu ll", NULL},
+ {"{\"foo\": bar}", NULL},
+ {"{\"foo\": bar\"x\"}", NULL},
{"fals", NULL},
/* Testing unterminated string. */
{"\"\\x", NULL},
/* Testing invalid UTF-16 number. */
{"\"\\u123x", NULL},
+ {"{\"\\u123x", NULL},
/* Testing imbalanced surrogate pairs. */
{"\"\\ud834f", NULL},
+ {"{\"\\ud834f\":0}", NULL},
{"\"\\ud834\\n", NULL},
+ {"{\"\\ud834\\n\":0}", NULL},
{"\"\\udd1ef", NULL},
+ {"{\"\\udd1ef\":0}", NULL},
{"\"\\ud834\\ud834\"", NULL},
+ {"{\"\\ud834\\ud834\"\":0}", NULL},
{"\"\\ud834\\u1234\"", NULL},
+ {"{\"\\ud834\\u1234\"\":0}", NULL},
{"\"\\ud834]\"", NULL},
+ {"{\"\\ud834]\"\":0}", NULL},
{"\"\\ud834 \"", NULL},
+ {"{\"\\ud834 \"\":0}", NULL},
{"\"\\ud834\\\\\"", NULL},
+ {"{\"\\ud834\\\\\"\":0}", NULL},
/* Testing embedded invalid whitechars. */
{"\"\n\"", NULL},
{"\"\t\"", NULL},