[PATCH] D69093: [llvm-objcopy] --add-symbol: fix crash if SHT_SYMTAB does not exist
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 02:21:06 PDT 2019
MaskRay created this revision.
MaskRay added reviewers: alexshap, grimar, jhenderson, labath, rupprecht.
Herald added subscribers: llvm-commits, seiya, abrachet, jakehehrlich, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
If SHT_SYMTAB does not exist, ELFObjcopy.cpp:handleArgs will crash due
to a null pointer reference.
for (const NewSymbolInfo &SI : Config.ELF->SymbolsToAdd) {
...
Obj.SymbolTable->addSymbol(
Fix this by creating .symtab and .strtab on demand in ELFBuilder<ELFT>::readSections,
if --add-symbol is specified.
Repository:
rL LLVM
https://reviews.llvm.org/D69093
Files:
test/tools/llvm-objcopy/ELF/add-symbol-no-symtab.test
tools/llvm-objcopy/ELF/ELFObjcopy.cpp
tools/llvm-objcopy/ELF/Object.cpp
tools/llvm-objcopy/ELF/Object.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69093.225379.patch
Type: text/x-patch
Size: 8891 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191017/51fbf778/attachment.bin>
More information about the llvm-commits
mailing list