aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2018-01-16 12:49:18 -0800
committerGravatar Craig Tiller <ctiller@google.com>2018-01-16 12:49:18 -0800
commitbe448700590c5995dd2bdf95223aa5de96d02160 (patch)
tree73348a7e94c0da4aada908523cd2017144f45ab2 /test
parent0fd2d7cf35a45dc8196768acad2516c5b7d7a04f (diff)
Fix issue whereby fuzzer creates infinitely deep creds (since this is not actually interesting)
Diffstat (limited to 'test')
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc
index 967a6d560f..884cbdb3e5 100644
--- a/test/core/end2end/fuzzers/api_fuzzer.cc
+++ b/test/core/end2end/fuzzers/api_fuzzer.cc
@@ -280,7 +280,11 @@ 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
+ return nullptr;
+ }
switch (next_byte(inp)) {
default:
end(inp);
@@ -288,8 +292,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 +342,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);