Skip to content

Commit

Permalink
Merge pull request #313 from amirlivneh/pass-by-reference
Browse files Browse the repository at this point in the history
fuzz: Pass FuzzedDataProvider by reference
  • Loading branch information
tatsuhiro-t authored Jan 8, 2025
2 parents 980349b + f95defc commit 0fd649a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fuzz/fuzz_http3serverreq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,15 @@ int send_data(nghttp3_conn *conn) {

namespace {
int set_stream_priorities(nghttp3_conn *conn,
FuzzedDataProvider *fuzzed_data_provider) {
for (; fuzzed_data_provider->ConsumeBool();) {
auto stream_id = fuzzed_data_provider->ConsumeIntegralInRange<int64_t>(
FuzzedDataProvider &fuzzed_data_provider) {
for (; fuzzed_data_provider.ConsumeBool();) {
auto stream_id = fuzzed_data_provider.ConsumeIntegralInRange<int64_t>(
0, NGHTTP3_MAX_VARINT);

nghttp3_pri pri{
.urgency = fuzzed_data_provider->ConsumeIntegralInRange<uint32_t>(
.urgency = fuzzed_data_provider.ConsumeIntegralInRange<uint32_t>(
0, NGHTTP3_URGENCY_LEVELS - 1),
.inc = fuzzed_data_provider->ConsumeIntegralInRange<uint8_t>(0, 1),
.inc = fuzzed_data_provider.ConsumeIntegralInRange<uint8_t>(0, 1),
};

auto rv = nghttp3_conn_set_server_stream_priority(conn, stream_id, &pri);
Expand Down Expand Up @@ -330,7 +330,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
}
}

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

Expand Down

0 comments on commit 0fd649a

Please sign in to comment.