From d14b268b9d0f37811c47cc6b1ebf2433fbb0ad0e Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 4 Feb 2017 01:18:10 +0300 Subject: [PATCH] libbacktrace: Fix uninitialized variable --- src/libbacktrace/pecoff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libbacktrace/pecoff.c b/src/libbacktrace/pecoff.c index 04e0bafb14981..2d6a9877219dc 100644 --- a/src/libbacktrace/pecoff.c +++ b/src/libbacktrace/pecoff.c @@ -607,7 +607,9 @@ coff_add (struct backtrace_state *state, int descriptor, // against the upstream libbacktrace, that's what's going on. uint32_t str_size; off_t str_off; - struct backtrace_view syms_view; + // NOTE: upstream doesn't have `{0}`, this is a fix for Rust issue #39468. + // If syms_view is not initialized, then `free(syms_view.base)` may segfault later. + struct backtrace_view syms_view = {0}; off_t syms_off; size_t syms_size; int syms_view_valid;