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

Add fuzz test for the CDN-Loop header parser #13183

Merged
merged 6 commits into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions test/extensions/filters/http/cdn_loop/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load(
"//bazel:envoy_build_system.bzl",
"envoy_cc_fuzz_test",
"envoy_cc_test",
"envoy_package",
)
Expand All @@ -17,6 +18,16 @@ envoy_cc_test(
],
)

envoy_cc_fuzz_test(
name = "parser_fuzz_test",
srcs = ["parser_fuzz_test.cc"],
corpus = "parser_corpus",
deps = [
"//source/extensions/filters/http/cdn_loop:parser_lib",
"//test/test_common:status_utility_lib",
],
)

envoy_cc_test(
name = "utils_test",
srcs = ["utils_test.cc"],
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions test/extensions/filters/http/cdn_loop/parser_fuzz_test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "extensions/filters/http/cdn_loop/parser.h"

#include "test/fuzz/fuzz_runner.h"

#include "absl/strings/string_view.h"

namespace Envoy {
namespace Fuzz {

DEFINE_FUZZER(const uint8_t* buf, size_t len) {
{
justin-mp marked this conversation as resolved.
Show resolved Hide resolved
Envoy::Extensions::HttpFilters::CdnLoop::Parser::ParseContext input(
absl::string_view(reinterpret_cast<const char*>(buf), len));
Envoy::Extensions::HttpFilters::CdnLoop::Parser::parseCdnInfoList(input).IgnoreError();
justin-mp marked this conversation as resolved.
Show resolved Hide resolved
}
}

} // namespace Fuzz
} // namespace Envoy