aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-05-10 07:58:41 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-05-10 07:58:41 -0700
commit7b622ab558882a984b597cd87fe7175f5e1eea23 (patch)
treea3f653893f7dfe865a6ebed009358e6260a3c208
parent1b84e038848277fbda554cabc75a3ea05f97bcc7 (diff)
ubsan fix: dont deref past end of array
-rw-r--r--test/cpp/microbenchmarks/bm_call_create.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc
index c91219e98c..67e7c02535 100644
--- a/test/cpp/microbenchmarks/bm_call_create.cc
+++ b/test/cpp/microbenchmarks/bm_call_create.cc
@@ -563,7 +563,8 @@ static void BM_IsolatedFilter(benchmark::State &state) {
}
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- size_t channel_size = grpc_channel_stack_size(&filters[0], filters.size());
+ size_t channel_size = grpc_channel_stack_size(
+ filters.size() == 0 ? NULL : &filters[0], filters.size());
grpc_channel_stack *channel_stack =
static_cast<grpc_channel_stack *>(gpr_zalloc(channel_size));
GPR_ASSERT(GRPC_LOG_IF_ERROR(