diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/core/end2end/fuzzers/api_fuzzer.cc | 13 | ||||
-rw-r--r-- | test/core/end2end/fuzzers/api_fuzzer_corpus/fuzz-input-d2ab5 | bin | 0 -> 48866 bytes | |||
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 8 |
3 files changed, 13 insertions, 8 deletions
diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index 967a6d560f..43c9fa19c6 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -280,7 +280,12 @@ static grpc_channel_credentials* read_ssl_channel_creds(input_stream* inp) { return creds; } -static grpc_call_credentials* read_call_creds(input_stream* inp) { +static grpc_call_credentials* read_call_creds(input_stream* inp, int depth) { + if (depth > 64) { + // prevent creating infinitely deep call creds + end(inp); + return nullptr; + } switch (next_byte(inp)) { default: end(inp); @@ -288,8 +293,8 @@ static grpc_call_credentials* read_call_creds(input_stream* inp) { case 0: return nullptr; case 1: { - grpc_call_credentials* c1 = read_call_creds(inp); - grpc_call_credentials* c2 = read_call_creds(inp); + grpc_call_credentials* c1 = read_call_creds(inp, depth + 1); + grpc_call_credentials* c2 = read_call_creds(inp, depth + 1); if (c1 != nullptr && c2 != nullptr) { grpc_call_credentials* out = grpc_composite_call_credentials_create(c1, c2, nullptr); @@ -338,7 +343,7 @@ static grpc_channel_credentials* read_channel_creds(input_stream* inp) { break; case 1: { grpc_channel_credentials* c1 = read_channel_creds(inp); - grpc_call_credentials* c2 = read_call_creds(inp); + grpc_call_credentials* c2 = read_call_creds(inp, 0); if (c1 != nullptr && c2 != nullptr) { grpc_channel_credentials* out = grpc_composite_channel_credentials_create(c1, c2, nullptr); diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/fuzz-input-d2ab5 b/test/core/end2end/fuzzers/api_fuzzer_corpus/fuzz-input-d2ab5 Binary files differnew file mode 100644 index 0000000000..1745798b68 --- /dev/null +++ b/test/core/end2end/fuzzers/api_fuzzer_corpus/fuzz-input-d2ab5 diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 4c8dfe0f40..a6ea5aada9 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -1609,7 +1609,7 @@ TEST_P(SecureEnd2endTest, AuthMetadataPluginKeyFailure) { Status s = stub_->Echo(&context, request, &response); EXPECT_FALSE(s.ok()); - EXPECT_EQ(s.error_code(), StatusCode::UNAUTHENTICATED); + EXPECT_EQ(s.error_code(), StatusCode::UNAVAILABLE); } TEST_P(SecureEnd2endTest, AuthMetadataPluginValueFailure) { @@ -1626,7 +1626,7 @@ TEST_P(SecureEnd2endTest, AuthMetadataPluginValueFailure) { Status s = stub_->Echo(&context, request, &response); EXPECT_FALSE(s.ok()); - EXPECT_EQ(s.error_code(), StatusCode::UNAUTHENTICATED); + EXPECT_EQ(s.error_code(), StatusCode::UNAVAILABLE); } TEST_P(SecureEnd2endTest, NonBlockingAuthMetadataPluginFailure) { @@ -1644,7 +1644,7 @@ TEST_P(SecureEnd2endTest, NonBlockingAuthMetadataPluginFailure) { Status s = stub_->Echo(&context, request, &response); EXPECT_FALSE(s.ok()); - EXPECT_EQ(s.error_code(), StatusCode::UNAUTHENTICATED); + EXPECT_EQ(s.error_code(), StatusCode::UNAVAILABLE); EXPECT_EQ(s.error_message(), grpc::string("Getting metadata from plugin failed with error: ") + kTestCredsPluginErrorMsg); @@ -1705,7 +1705,7 @@ TEST_P(SecureEnd2endTest, BlockingAuthMetadataPluginFailure) { Status s = stub_->Echo(&context, request, &response); EXPECT_FALSE(s.ok()); - EXPECT_EQ(s.error_code(), StatusCode::UNAUTHENTICATED); + EXPECT_EQ(s.error_code(), StatusCode::UNAVAILABLE); EXPECT_EQ(s.error_message(), grpc::string("Getting metadata from plugin failed with error: ") + kTestCredsPluginErrorMsg); |