diff options
author | Andrew Kaylor <andrew.kaylor@intel.com> | 2013-02-07 21:30:54 +0000 |
---|---|---|
committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2013-02-07 21:30:54 +0000 |
commit | 213f6727c0d28242afa873edb83b8561e68bda42 (patch) | |
tree | 8a1c5fc831d5bfc11aae098c7192886d1f15586c /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | |
parent | 9006156a044fc1ffc4e663b2beb9b52177ac532d (diff) | |
download | bcm5719-llvm-213f6727c0d28242afa873edb83b8561e68bda42.tar.gz bcm5719-llvm-213f6727c0d28242afa873edb83b8561e68bda42.zip |
Fixing stale pointer problem in ELFObjectFile
llvm-svn: 174665
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 6d6d1ecfff0..c2dc7932a2f 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -189,10 +189,11 @@ ObjectFileELF::CreateInstance (const lldb::ModuleSP &module_sp, 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) { |