diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-08-30 20:20:24 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-08-30 20:20:24 +0000 |
commit | ac8cfab51fe45b1b69931b50a1c91ac408a3ea63 (patch) | |
tree | 3c78ec82bb9ab6442ad1309bd74ea540f0bbc335 /llvm/lib/Object/COFFObjectFile.cpp | |
parent | 000b071b07477275c8a1bb36116d8d82f239fd20 (diff) | |
download | bcm5719-llvm-ac8cfab51fe45b1b69931b50a1c91ac408a3ea63.tar.gz bcm5719-llvm-ac8cfab51fe45b1b69931b50a1c91ac408a3ea63.zip |
[COFFObjectFile] Ignore broken symbol table
When binaries are compressed by UPX, information about symbol table
offset and symbol count remain unchanged (but became invalid due to
compression).
This causes failure in the constructor and the rest of the binary cannot
be processed.
Instead, reset symbol related information (symbol/string table pointers,
sizes) - this should disable the related iterators and functions while
the rest of the binary can still be processed.
Patch by Bandzi Michal!
llvm-svn: 280147
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/COFFObjectFile.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index a9a8107a753..601a7faba32 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/lib/Object/COFFObjectFile.cpp @@ -729,8 +729,12 @@ COFFObjectFile::COFFObjectFile(MemoryBufferRef Object, std::error_code &EC) // Initialize the pointer to the symbol table. if (getPointerToSymbolTable() != 0) { - if ((EC = initSymbolTablePtr())) - return; + if ((EC = initSymbolTablePtr())) { + SymbolTable16 = nullptr; + SymbolTable32 = nullptr; + StringTable = nullptr; + StringTableSize = 0; + } } else { // We had better not have any symbols if we don't have a symbol table. if (getNumberOfSymbols() != 0) { |