From 8f668e976ea0bbd7d3ac352247c1fdead6acbb31 Mon Sep 17 00:00:00 2001 From: Yifan Yang Date: Tue, 28 Jul 2020 02:27:47 -0400 Subject: [PATCH] fuzz: fixing unsigned integer underflow (#12289) Signed-off-by: Yifan Yang --- api/envoy/config/tap/v3/common.proto | 4 ++-- api/envoy/config/tap/v4alpha/common.proto | 4 ++-- generated_api_shadow/envoy/config/tap/v3/common.proto | 4 ++-- generated_api_shadow/envoy/config/tap/v4alpha/common.proto | 4 ++-- ...zz-testcase-minimized-filter_fuzz_test-5728217898680320 | 7 +++++++ 5 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 test/extensions/filters/http/common/fuzz/filter_corpus/clusterfuzz-testcase-minimized-filter_fuzz_test-5728217898680320 diff --git a/api/envoy/config/tap/v3/common.proto b/api/envoy/config/tap/v3/common.proto index 812c30399e75..81de393e0581 100644 --- a/api/envoy/config/tap/v3/common.proto +++ b/api/envoy/config/tap/v3/common.proto @@ -123,10 +123,10 @@ message HttpGenericBodyMatch { option (validate.required) = true; // Text string to be located in HTTP body. - string string_match = 1; + string string_match = 1 [(validate.rules).string = {min_len: 1}]; // Sequence of bytes to be located in HTTP body. - bytes binary_match = 2; + bytes binary_match = 2 [(validate.rules).bytes = {min_len: 1}]; } } diff --git a/api/envoy/config/tap/v4alpha/common.proto b/api/envoy/config/tap/v4alpha/common.proto index 281150715c1b..5ce87d5b5770 100644 --- a/api/envoy/config/tap/v4alpha/common.proto +++ b/api/envoy/config/tap/v4alpha/common.proto @@ -127,10 +127,10 @@ message HttpGenericBodyMatch { option (validate.required) = true; // Text string to be located in HTTP body. - string string_match = 1; + string string_match = 1 [(validate.rules).string = {min_len: 1}]; // Sequence of bytes to be located in HTTP body. - bytes binary_match = 2; + bytes binary_match = 2 [(validate.rules).bytes = {min_len: 1}]; } } diff --git a/generated_api_shadow/envoy/config/tap/v3/common.proto b/generated_api_shadow/envoy/config/tap/v3/common.proto index 812c30399e75..81de393e0581 100644 --- a/generated_api_shadow/envoy/config/tap/v3/common.proto +++ b/generated_api_shadow/envoy/config/tap/v3/common.proto @@ -123,10 +123,10 @@ message HttpGenericBodyMatch { option (validate.required) = true; // Text string to be located in HTTP body. - string string_match = 1; + string string_match = 1 [(validate.rules).string = {min_len: 1}]; // Sequence of bytes to be located in HTTP body. - bytes binary_match = 2; + bytes binary_match = 2 [(validate.rules).bytes = {min_len: 1}]; } } diff --git a/generated_api_shadow/envoy/config/tap/v4alpha/common.proto b/generated_api_shadow/envoy/config/tap/v4alpha/common.proto index 281150715c1b..5ce87d5b5770 100644 --- a/generated_api_shadow/envoy/config/tap/v4alpha/common.proto +++ b/generated_api_shadow/envoy/config/tap/v4alpha/common.proto @@ -127,10 +127,10 @@ message HttpGenericBodyMatch { option (validate.required) = true; // Text string to be located in HTTP body. - string string_match = 1; + string string_match = 1 [(validate.rules).string = {min_len: 1}]; // Sequence of bytes to be located in HTTP body. - bytes binary_match = 2; + bytes binary_match = 2 [(validate.rules).bytes = {min_len: 1}]; } } diff --git a/test/extensions/filters/http/common/fuzz/filter_corpus/clusterfuzz-testcase-minimized-filter_fuzz_test-5728217898680320 b/test/extensions/filters/http/common/fuzz/filter_corpus/clusterfuzz-testcase-minimized-filter_fuzz_test-5728217898680320 new file mode 100644 index 000000000000..b59917510f20 --- /dev/null +++ b/test/extensions/filters/http/common/fuzz/filter_corpus/clusterfuzz-testcase-minimized-filter_fuzz_test-5728217898680320 @@ -0,0 +1,7 @@ +config { + name: "envoy.filters.http.tap" + typed_config { + type_url: "type.googleapis.com/envoy.extensions.filters.http.tap.v3.Tap" + value: "\no\022m\nb\n`\nD\032B\n@\n\030\032\026\n\024\n\n\032\010\032\006J\004\022\002\n\000\n\006\032\004\032\002*\000\n$\n\"\n\002 \001\n\034\032\032\032\030\n\026\n\002 \001\n\020\032\016\032\014\n\n\n\002 \001\n\004\032\002B\000\n\030\n\026\n\002 \001\n\020\032\016\032\014\n\n\n\002 \001\n\004\032\002B\000\022\007\n\005\032\003\n\001(" + } +} \ No newline at end of file