diff --git a/test/common/http/utility_corpus/clusterfuzz-testcase-minimized-utility_fuzz_test-5091558495092736 b/test/common/http/utility_corpus/clusterfuzz-testcase-minimized-utility_fuzz_test-5091558495092736 new file mode 100644 index 0000000000000..aff9fb7726040 --- /dev/null +++ b/test/common/http/utility_corpus/clusterfuzz-testcase-minimized-utility_fuzz_test-5091558495092736 @@ -0,0 +1,17 @@ +initialize_and_validate { + custom_settings_parameters { + identifier { + value: 11008 + } + value { + value: 65536 + } + } + custom_settings_parameters { + identifier { + value: 11008 + } + value { + } + } +} diff --git a/test/common/http/utility_corpus/valid b/test/common/http/utility_corpus/valid index f47f99e15a995..1ea7275bf45e8 100644 --- a/test/common/http/utility_corpus/valid +++ b/test/common/http/utility_corpus/valid @@ -1,2 +1 @@ -find_query_string: "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\7\177\177\17 -U²@/177\177N¿77\177" \ No newline at end of file +find_query_string: "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\7\177\177\17U²@/177\177N¿77\177" diff --git a/test/common/http/utility_fuzz_test.cc b/test/common/http/utility_fuzz_test.cc index e3524fde27e46..18d5c0c4c388a 100644 --- a/test/common/http/utility_fuzz_test.cc +++ b/test/common/http/utility_fuzz_test.cc @@ -79,7 +79,28 @@ DEFINE_PROTO_FUZZER(const test::common::http::UtilityTestCase& input) { } case test::common::http::UtilityTestCase::kInitializeAndValidate: { const auto& options = input.initialize_and_validate(); - Http2::Utility::initializeAndValidateOptions(options); + try { + Http2::Utility::initializeAndValidateOptions(options); + } catch (EnvoyException& e) { + absl::string_view msg = e.what(); + // initializeAndValidateOptions throws exceptions for 4 different reasons due to malformed + // settings, so check for them and allow any other exceptions through + if (absl::StartsWith( + msg, "server push is not supported by Envoy and can not be enabled via a SETTINGS " + "parameter.") || + absl::StartsWith( + msg, "the \"allow_connect\" SETTINGS parameter must only be configured through the " + "named field") || + absl::StartsWith( + msg, "inconsistent HTTP/2 custom SETTINGS parameter(s) detected; identifiers =") || + absl::EndsWith( + msg, "HTTP/2 SETTINGS parameter(s) can not be configured through both named and " + "custom parameters")) { + ENVOY_LOG_MISC(trace, "Caught exception {} in initializeAndValidateOptions test", e.what()); + } else { + throw EnvoyException(e.what()); + } + } break; }