From f295808f385d64e362af92b1d7226a975b8a8ad0 Mon Sep 17 00:00:00 2001 From: Amir Livneh Date: Sat, 28 Dec 2024 16:52:36 -0500 Subject: [PATCH] Fuzz settings in fuzz_http3serverreq --- fuzz/fuzz_http3serverreq.cc | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/fuzz/fuzz_http3serverreq.cc b/fuzz/fuzz_http3serverreq.cc index fde5afb..6a8792f 100644 --- a/fuzz/fuzz_http3serverreq.cc +++ b/fuzz/fuzz_http3serverreq.cc @@ -2,6 +2,16 @@ #include +#ifdef __cplusplus +extern "C" { +#endif // defined(__cplusplus) + +#include "nghttp3_conn.h" + +#ifdef __cplusplus +} +#endif // defined(__cplusplus) + #include static int send_data(nghttp3_conn *conn) { @@ -35,9 +45,23 @@ static int send_data(nghttp3_conn *conn) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { FuzzedDataProvider fuzzed_data_provider(data, size); nghttp3_callbacks callbacks{}; - nghttp3_settings settings; - nghttp3_settings_default(&settings); + nghttp3_settings settings = { + .max_field_section_size = + fuzzed_data_provider.ConsumeIntegralInRange(0, + NGHTTP3_VARINT_MAX), + .qpack_max_dtable_capacity = + fuzzed_data_provider.ConsumeIntegralInRange(0, + NGHTTP3_VARINT_MAX), + .qpack_encoder_max_dtable_capacity = + fuzzed_data_provider.ConsumeIntegralInRange(0, + NGHTTP3_VARINT_MAX), + .qpack_blocked_streams = + fuzzed_data_provider.ConsumeIntegralInRange(0, + NGHTTP3_VARINT_MAX), + .enable_connect_protocol = fuzzed_data_provider.ConsumeIntegral(), + .h3_datagram = fuzzed_data_provider.ConsumeIntegral(), + }; nghttp3_conn *conn; auto rv =