diff options
author | Arjun <pkillarjun@protonmail.com> | 2024-08-02 16:58:32 +0100 |
---|---|---|
committer | Andrew Clayton <a.clayton@nginx.com> | 2024-08-02 17:39:15 +0100 |
commit | bc49274db06a9795d090bbbd22c074888a9ef583 (patch) | |
tree | a0650a9104a2f954154285135014a863edbf06d6 | |
parent | 900d25c39624980a5416b9d7d6218312ddbbac07 (diff) | |
download | unit-bc49274db06a9795d090bbbd22c074888a9ef583.tar.gz unit-bc49274db06a9795d090bbbd22c074888a9ef583.tar.bz2 |
fuzzing: updated JSON target
Added 'nxt_conf_json_length' check for extra coverage.
Signed-off-by: Arjun <pkillarjun@protonmail.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
-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; |