Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuzz: Exercise sending response headers #298

Merged
merged 2 commits into from
Jan 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion fuzz/fuzz_http3serverreq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,28 @@ static int end_stream(nghttp3_conn *conn, int64_t stream_id,
void *conn_user_data, void *stream_user_data) {
auto fuzzed_data_provider = static_cast<FuzzedDataProvider *>(conn_user_data);

return fuzzed_data_provider->ConsumeBool() ? NGHTTP3_ERR_CALLBACK_FAILURE : 0;
if (fuzzed_data_provider->ConsumeBool()) {
return NGHTTP3_ERR_CALLBACK_FAILURE;
}

if (fuzzed_data_provider->ConsumeBool()) {
return 0;
}

auto name = fuzzed_data_provider->ConsumeRandomLengthString();
auto value = fuzzed_data_provider->ConsumeRandomLengthString();

const nghttp3_nv nva[] = {
{
.name = (uint8_t *)name.c_str(),
.value = (uint8_t *)value.c_str(),
.namelen = name.size(),
.valuelen = value.size(),
},
};

return nghttp3_conn_submit_response(conn, stream_id, nva,
nghttp3_arraylen(nva), nullptr);
}

static int reset_stream(nghttp3_conn *conn, int64_t stream_id,
Expand Down Expand Up @@ -200,6 +221,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {

nghttp3_conn_set_max_client_streams_bidi(conn, 100);

nghttp3_conn_bind_qpack_streams(conn, 7, 11);

nghttp3_ssize nread;

if (send_data(conn) != 0) {
Expand Down
Loading