Fix an uninitialized memory use error when interpreting
compact unwind encodings for x86_64 / i386 omit-frame-pointer
code. It was possible for lldb to get the location of saved
registers incorrect for some of these functions.
<rdar://problem/20753264>
llvm-svn: 236478
diff --git a/lldb/source/Symbol/CompactUnwindInfo.cpp b/lldb/source/Symbol/CompactUnwindInfo.cpp
index 17a4a99..b44568c 100644
--- a/lldb/source/Symbol/CompactUnwindInfo.cpp
+++ b/lldb/source/Symbol/CompactUnwindInfo.cpp
@@ -841,7 +841,7 @@
//
// This is done with Lehmer code permutation, e.g. see
// http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms
- int permunreg[6];
+ int permunreg[6] = {0, 0, 0, 0, 0, 0};
// This decodes the variable-base number in the 10 bits
// and gives us the Lehmer code sequence which can then
@@ -901,7 +901,7 @@
// Decode the Lehmer code for this permutation of
// the registers v. http://en.wikipedia.org/wiki/Lehmer_code
- int registers[6];
+ int registers[6] = { UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE };
bool used[7] = { false, false, false, false, false, false, false };
for (uint32_t i = 0; i < register_count; i++)
{
@@ -1115,7 +1115,7 @@
//
// This is done with Lehmer code permutation, e.g. see
// http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms
- int permunreg[6];
+ int permunreg[6] = {0, 0, 0, 0, 0, 0};
// This decodes the variable-base number in the 10 bits
// and gives us the Lehmer code sequence which can then
@@ -1175,7 +1175,7 @@
// Decode the Lehmer code for this permutation of
// the registers v. http://en.wikipedia.org/wiki/Lehmer_code
- int registers[6];
+ int registers[6] = { UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE };
bool used[7] = { false, false, false, false, false, false, false };
for (uint32_t i = 0; i < register_count; i++)
{