diff options
author | Arjun <pkillarjun@protonmail.com> | 2024-08-02 18:21:12 +0530 |
---|---|---|
committer | Andrew Clayton <a.clayton@nginx.com> | 2024-08-02 17:39:15 +0100 |
commit | e56c4edefa3726ffe86f66fde3cba9e9365bfd61 (patch) | |
tree | 1ec3e67439acf79f6eaef180a5fa6a8845390f11 /fuzzing/nxt_json_fuzz.c | |
parent | a91b961d620dc17c98b998a9142050defe46b56e (diff) | |
download | unit-e56c4edefa3726ffe86f66fde3cba9e9365bfd61.tar.gz unit-e56c4edefa3726ffe86f66fde3cba9e9365bfd61.tar.bz2 |
fuzzing: code cleanup
Signed-off-by: Arjun <pkillarjun@protonmail.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to '')
-rw-r--r-- | fuzzing/nxt_json_fuzz.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fuzzing/nxt_json_fuzz.c b/fuzzing/nxt_json_fuzz.c index cfeb395d..3a9201d8 100644 --- a/fuzzing/nxt_json_fuzz.c +++ b/fuzzing/nxt_json_fuzz.c @@ -54,19 +54,24 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) goto failed; } - thr->runtime = rt; - rt->mem_pool = mp; + rt->languages = nxt_array_create(mp, 1, sizeof(nxt_app_lang_module_t)); + if (rt->languages == NULL) { + goto failed; + } input.start = (u_char *)data; input.length = size; + thr->runtime = rt; + rt->mem_pool = mp; + + nxt_memzero(&vldt, sizeof(nxt_conf_validation_t)); + conf = nxt_conf_json_parse_str(mp, &input); if (conf == NULL) { goto failed; } - nxt_memzero(&vldt, sizeof(nxt_conf_validation_t)); - vldt.pool = nxt_mp_create(1024, 128, 256, 32); if (vldt.pool == NULL) { goto failed; @@ -76,13 +81,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) vldt.conf_pool = mp; vldt.ver = NXT_VERNUM; - rt->languages = nxt_array_create(mp, 1, sizeof(nxt_app_lang_module_t)); - if (rt->languages == NULL) { - goto failed; - } - nxt_conf_validate(&vldt); - nxt_mp_destroy(vldt.pool); failed: |