diff options
-rw-r--r-- | fuzzing/nxt_json_fuzz.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fuzzing/nxt_json_fuzz.c b/fuzzing/nxt_json_fuzz.c index 3a9201d8..fa222988 100644 --- a/fuzzing/nxt_json_fuzz.c +++ b/fuzzing/nxt_json_fuzz.c @@ -31,12 +31,13 @@ LLVMFuzzerInitialize(int *argc, char ***argv) int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - nxt_mp_t *mp; - nxt_str_t input; - nxt_thread_t *thr; - nxt_runtime_t *rt; - nxt_conf_value_t *conf; - nxt_conf_validation_t vldt; + nxt_mp_t *mp; + nxt_str_t input; + nxt_thread_t *thr; + nxt_runtime_t *rt; + nxt_conf_value_t *conf; + nxt_conf_validation_t vldt; + nxt_conf_json_pretty_t pretty; if (size < KMININPUTLENGTH || size > KMAXINPUTLENGTH) { return 0; @@ -65,6 +66,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) thr->runtime = rt; rt->mem_pool = mp; + nxt_memzero(&pretty, sizeof(nxt_conf_json_pretty_t)); nxt_memzero(&vldt, sizeof(nxt_conf_validation_t)); conf = nxt_conf_json_parse_str(mp, &input); @@ -72,6 +74,9 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) goto failed; } + nxt_conf_json_length(conf, NULL); + nxt_conf_json_length(conf, &pretty); + vldt.pool = nxt_mp_create(1024, 128, 256, 32); if (vldt.pool == NULL) { goto failed; |