Skip to content

Commit

Permalink
fuzz: Make stream_id non-negative integer
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Dec 31, 2024
1 parent 4583d56 commit 0290b2f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion fuzz/fuzz_http3serverreq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

#include <nghttp3/nghttp3.h>

#ifdef __cplusplus
extern "C" {
#endif // defined(__cplusplus)

#include "nghttp3_macro.h"

#ifdef __cplusplus
}
#endif // defined(__cplusplus)

static int send_data(nghttp3_conn *conn) {
std::array<nghttp3_vec, 16> vec;
int64_t stream_id;
Expand Down Expand Up @@ -55,7 +65,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
}

while (fuzzed_data_provider.remaining_bytes() > 0) {
auto stream_id = fuzzed_data_provider.ConsumeIntegral<int64_t>();
auto stream_id = fuzzed_data_provider.ConsumeIntegralInRange<int64_t>(
0, NGHTTP3_MAX_VARINT);
auto chunk_size = fuzzed_data_provider.ConsumeIntegral<size_t>();
auto chunk = fuzzed_data_provider.ConsumeBytes<uint8_t>(chunk_size);
auto fin = fuzzed_data_provider.ConsumeBool();
Expand Down

0 comments on commit 0290b2f

Please sign in to comment.