Hello,

We were testing libunwind-coredump and got some warnings about
uninitialized eh_valid_mask.
The code was working fine because the default value of the mask was 0, but
it could potentially take a wrong branch if there's garbage in memory.

Please find the patch attached.

Thanks,
Felipe
From 1086037739cef67e8167cd08b033c827d8d2911b Mon Sep 17 00:00:00 2001
From: Felipe Cerqueira <cerque...@google.com>
Date: Thu, 17 Aug 2017 11:05:11 -0700
Subject: [PATCH 1/1] Fix uninitialized variable c->dwarf.eh_valid_mask.

When testing libunwind-coredump, got warnings about initialized
variable in x86_64/Gregs.c:
    else if ((c->dwarf.eh_valid_mask & mask) != 0)
---
 src/x86_64/init.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/x86_64/init.h b/src/x86_64/init.h
index 3ceab79..a7a996f 100644
--- a/src/x86_64/init.h
+++ b/src/x86_64/init.h
@@ -83,6 +83,7 @@ common_init (struct cursor *c, unsigned use_prev_instr)
   c->dwarf.pi_is_dynamic = 0;
   c->dwarf.hint = 0;
   c->dwarf.prev_rs = 0;
+  c->dwarf.eh_valid_mask = 0;
 
   return 0;
 }
-- 

_______________________________________________
Libunwind-devel mailing list
Libunwind-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to