From 900d25c39624980a5416b9d7d6218312ddbbac07 Mon Sep 17 00:00:00 2001 From: Arjun Date: Fri, 2 Aug 2024 16:51:15 +0100 Subject: 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 Signed-off-by: Andrew Clayton --- fuzzing/nxt_http_h1p_fuzz.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'fuzzing/nxt_http_h1p_fuzz.c') diff --git a/fuzzing/nxt_http_h1p_fuzz.c b/fuzzing/nxt_http_h1p_fuzz.c index 6b54431c..b8893ad6 100644 --- a/fuzzing/nxt_http_h1p_fuzz.c +++ b/fuzzing/nxt_http_h1p_fuzz.c @@ -61,12 +61,28 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) goto failed; } + req->proto.h1 = nxt_mp_zget(mp, sizeof(nxt_h1proto_t)); + if (req->proto.h1 == NULL) { + goto failed; + } + + req->conf = nxt_mp_zget(mp, sizeof(nxt_socket_conf_joint_t)); + if (req->conf == NULL) { + goto failed; + } + + req->conf->socket_conf = nxt_mp_zget(mp, sizeof(nxt_socket_conf_t)); + if (req->conf->socket_conf == NULL) { + goto failed; + } + buf.start = (u_char *)data; buf.end = (u_char *)data + size; buf.pos = buf.start; buf.free = buf.end; req->mem_pool = mp; + req->conf->socket_conf->max_body_size = 8 * 1024 * 1024; nxt_memzero(&rp, sizeof(nxt_http_request_parse_t)); -- cgit