aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/surface
diff options
context:
space:
mode:
authorGravatar Vitaly Buka <vitalybuka@chromium.org>2016-08-01 19:34:51 -0700
committerGravatar Vitaly Buka <vitalybuka@chromium.org>2016-08-01 19:39:51 -0700
commite60003d4f902b7b819cff6ae88c41bcd96b55b81 (patch)
tree80db5fc45f1a48c5752cc7231e3bc3ed7fd8c98b /src/core/lib/surface
parent5b88eb228f52a4746f1692a58ab8f963e224c82f (diff)
Fix stack use after scope in call.c
AddressSanitizer detects stack-use-after-scope bug. This means that variable was used at a point when compiler assume that it's dead. Here compression_md lifetime is limited by switch scope. However implementation of execute_op blow access it outside the scope.
Diffstat (limited to 'src/core/lib/surface')
-rw-r--r--src/core/lib/surface/call.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c
index 70c94791f8..59295f47f0 100644
--- a/src/core/lib/surface/call.c
+++ b/src/core/lib/surface/call.c
@@ -1367,6 +1367,9 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
int num_completion_callbacks_needed = 1;
grpc_call_error error = GRPC_CALL_OK;
+ // sent_initial_metadata guards against variable reuse.
+ grpc_metadata compression_md;
+
GPR_TIMER_BEGIN("grpc_call_start_batch", 0);
GRPC_CALL_LOG_BATCH(GPR_INFO, call, ops, nops, notify_tag);
@@ -1412,8 +1415,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
goto done_with_error;
}
/* process compression level */
- grpc_metadata compression_md;
- memset(&compression_md, 0, sizeof(grpc_metadata));
+ memset(&compression_md, 0, sizeof(compression_md));
size_t additional_metadata_count = 0;
grpc_compression_level effective_compression_level;
bool level_set = false;