Skip to content

Commit

Permalink
fuzz: Fix ext_proc integration test fuzzer issue (envoyproxy#29798)
Browse files Browse the repository at this point in the history
Signed-off-by: Yanjun Xiang <[email protected]>
  • Loading branch information
yanjunxiang-google authored Nov 10, 2023
1 parent 3f1080d commit d3464bf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/extensions/filters/http/ext_proc/ext_proc_grpc_fuzz.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,11 @@ fuzzExtProcRun(const test::extensions::filters::http::ext_proc::ExtProcGrpcTestC
FuzzedDataProvider downstream_provider(
reinterpret_cast<const uint8_t*>(input.downstream_data().data()),
input.downstream_data().size());
FuzzedDataProvider ext_proc_provider(
reinterpret_cast<const uint8_t*>(input.ext_proc_data().data()), input.ext_proc_data().size());
static std::unique_ptr<std::string> ext_proc_data = nullptr;
ext_proc_data = std::make_unique<std::string>(input.ext_proc_data());
static std::unique_ptr<FuzzedDataProvider> ext_proc_provider = nullptr;
ext_proc_provider = std::make_unique<FuzzedDataProvider>(
reinterpret_cast<const uint8_t*>(ext_proc_data->data()), ext_proc_data->size());

static std::unique_ptr<ExtProcIntegrationFuzz> fuzzer = nullptr;
static std::unique_ptr<ExtProcFuzzHelper> fuzz_helper = nullptr;
Expand All @@ -242,7 +245,7 @@ fuzzExtProcRun(const test::extensions::filters::http::ext_proc::ExtProcGrpcTestC
TestEnvironment::getIpVersionsForTest()[0], TestEnvironment::getsGrpcVersionsForTest()[0]);
}
// Initialize fuzz_helper.
fuzz_helper = std::make_unique<ExtProcFuzzHelper>(&ext_proc_provider);
fuzz_helper = std::make_unique<ExtProcFuzzHelper>(ext_proc_provider.get());

// Initialize test server.
if (fuzzCreateEnvoy(fuzz_exec_count, persistent_mode)) {
Expand Down Expand Up @@ -295,6 +298,8 @@ fuzzExtProcRun(const test::extensions::filters::http::ext_proc::ExtProcGrpcTestC
} else {
fuzzer->tearDown(true);
}
ext_proc_data.reset();
ext_proc_provider.reset();
fuzz_helper.reset();
}

Expand Down

0 comments on commit d3464bf

Please sign in to comment.