[Lldb-commits] [lldb] r236478 - Fix an uninitialized memory use error when interpreting

Jason Molenda jmolenda at apple.com
Mon May 4 19:05:53 PDT 2015


Author: jmolenda
Date: Mon May  4 21:05:53 2015
New Revision: 236478

URL: http://llvm.org/viewvc/llvm-project?rev=236478&view=rev
Log:
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> 

Modified:
    lldb/trunk/source/Symbol/CompactUnwindInfo.cpp

Modified: lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompactUnwindInfo.cpp?rev=236478&r1=236477&r2=236478&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompactUnwindInfo.cpp (original)
+++ lldb/trunk/source/Symbol/CompactUnwindInfo.cpp Mon May  4 21:05:53 2015
@@ -841,7 +841,7 @@ CompactUnwindInfo::CreateUnwindPlan_x86_
                 //
                 // 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 @@ CompactUnwindInfo::CreateUnwindPlan_x86_
                 // 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 @@ CompactUnwindInfo::CreateUnwindPlan_i386
                 //
                 // 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 @@ CompactUnwindInfo::CreateUnwindPlan_i386
                 // 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++)
                 {





More information about the lldb-commits mailing list