summaryrefslogtreecommitdiffhomepage
path: root/fuzzing
diff options
context:
space:
mode:
authorArjun <pkillarjun@protonmail.com>2024-08-02 16:51:15 +0100
committerAndrew Clayton <a.clayton@nginx.com>2024-08-02 17:39:15 +0100
commit900d25c39624980a5416b9d7d6218312ddbbac07 (patch)
tree5074e2c5eb26ba5a8efc17f173362d83f31256ca /fuzzing
parente56c4edefa3726ffe86f66fde3cba9e9365bfd61 (diff)
downloadunit-900d25c39624980a5416b9d7d6218312ddbbac07.tar.gz
unit-900d25c39624980a5416b9d7d6218312ddbbac07.tar.bz2
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 <pkillarjun@protonmail.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'fuzzing')
-rw-r--r--fuzzing/nxt_http_h1p_fuzz.c16
1 files changed, 16 insertions, 0 deletions
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));