Skip to content

Commit

Permalink
fuzz_http3serverreq: Read multiple times before sending data
Browse files Browse the repository at this point in the history
  • Loading branch information
amirlivneh committed Jan 3, 2025
1 parent 9ef874f commit eb6a93c
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions fuzz/fuzz_http3serverreq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
}

for (; fuzzed_data_provider.remaining_bytes() > 0;) {
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();

nread = nghttp3_conn_read_stream(conn, stream_id, chunk.data(),
chunk.size(), fin);
if (nread < 0) {
goto fin;
for (; fuzzed_data_provider.remaining_bytes() > 0 &&
fuzzed_data_provider.ConsumeBool();) {
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();

nread = nghttp3_conn_read_stream(conn, stream_id, chunk.data(),
chunk.size(), fin);
if (nread < 0) {
goto fin;
}
}

if (set_stream_priorities(conn, &fuzzed_data_provider) != 0) {
Expand Down

0 comments on commit eb6a93c

Please sign in to comment.