From 0112a70af124c8caea9f5037584d90f1bbd385a3 Mon Sep 17 00:00:00 2001 From: Arjun Date: Fri, 2 Aug 2024 15:36:07 +0530 Subject: [PATCH] fuzzing: fixed harness bug False positive bug in harness due to improper use of the internal API. Fixes: a93d878 ("fuzzing: add fuzzing targets") Signed-off-by: Arjun --- fuzzing/nxt_http_h1p_fuzz.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fuzzing/nxt_http_h1p_fuzz.c b/fuzzing/nxt_http_h1p_fuzz.c index a170463a0..164fa68c9 100644 --- a/fuzzing/nxt_http_h1p_fuzz.c +++ b/fuzzing/nxt_http_h1p_fuzz.c @@ -75,6 +75,22 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) goto failed; } + r_h1p->proto.h1 = nxt_mp_zget(mp, sizeof(nxt_h1proto_t)); + if (r_h1p->proto.h1 == NULL) { + goto failed; + } + + r_h1p->conf = nxt_mp_zget(mp, sizeof(nxt_socket_conf_joint_t)); + if (r_h1p->conf == NULL) { + goto failed; + } + + r_h1p->conf->socket_conf = nxt_mp_zget(mp, sizeof(nxt_socket_conf_t)); + if (r_h1p->conf->socket_conf == NULL) { + goto failed; + } + + r_h1p->conf->socket_conf->max_body_size = 8 * 1024 * 1024; r_h1p->mem_pool = mp; nxt_http_fields_process(rp.fields, &nxt_h1p_fields_hash, r_h1p);