Skip to content

Commit

Permalink
fuzz: Fuzz connection shutdown (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
amirlivneh authored Jan 9, 2025
1 parent 0fd649a commit 1c3fe9a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions fuzz/fuzz_http3serverreq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
return 0;
}

auto shutdown_started = false;

rv = nghttp3_conn_bind_control_stream(conn, 3);
if (rv != 0) {
goto fin;
}

nghttp3_conn_set_max_client_streams_bidi(
conn, fuzzed_data_provider.ConsumeIntegral<uint64_t>());

Expand Down Expand Up @@ -330,6 +337,20 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
}
}

if (!shutdown_started && fuzzed_data_provider.ConsumeBool()) {
if (nghttp3_conn_submit_shutdown_notice(conn) != 0) {
goto fin;
}
}

if (!shutdown_started && fuzzed_data_provider.ConsumeBool()) {
shutdown_started = true;

if (nghttp3_conn_shutdown(conn) != 0) {
goto fin;
}
}

if (set_stream_priorities(conn, fuzzed_data_provider) != 0) {
goto fin;
}
Expand Down

0 comments on commit 1c3fe9a

Please sign in to comment.