aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/end2end/fuzzers/api_fuzzer.cc
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2018-01-17 10:38:53 -0800
committerGravatar David Garcia Quintas <dgq@google.com>2018-01-17 10:38:53 -0800
commit41d27e104fcfcf2a3c25657b99303d61fdd4d947 (patch)
tree0e2c9ab4b9aaeca7a6d52bbab51bc100e293a113 /test/core/end2end/fuzzers/api_fuzzer.cc
parent269ee29e032e3edc62d5b63ce44b5135979249da (diff)
parent3538efb53bd6d3bfca91aa50db7a6e1b97b9c855 (diff)
Merge branch 'master' of github.com:grpc/grpc into conn_subchannel
Diffstat (limited to 'test/core/end2end/fuzzers/api_fuzzer.cc')
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.cc13
1 files changed, 9 insertions, 4 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);