[Lldb-commits] [lldb] r174665 - Fixing stale pointer problem in ELFObjectFile

Andrew Kaylor andrew.kaylor at intel.com
Thu Feb 7 13:30:55 PST 2013


Author: akaylor
Date: Thu Feb  7 15:30:54 2013
New Revision: 174665

URL: http://llvm.org/viewvc/llvm-project?rev=174665&view=rev
Log:
Fixing stale pointer problem in ELFObjectFile

Modified:
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=174665&r1=174664&r2=174665&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Thu Feb  7 15:30:54 2013
@@ -189,10 +189,11 @@ ObjectFileELF::CreateInstance (const lld
         const uint8_t *magic = data_sp->GetBytes() + data_offset;
         if (ELFHeader::MagicBytesMatch(magic))
         {
-            // Update the data to contain the entire file
             // Update the data to contain the entire file if it doesn't already
-            if (data_sp->GetByteSize() < length)
+            if (data_sp->GetByteSize() < length) {
                 data_sp = file->MemoryMapFileContents(file_offset, length);
+                magic = data_sp->GetBytes() + data_offset;
+            }
             unsigned address_size = ELFHeader::AddressSizeInBytes(magic);
             if (address_size == 4 || address_size == 8)
             {





More information about the lldb-commits mailing list