]> granicus.if.org Git - llvm/commit
Fix a crash in llvm-nm for a bad Mach-O file that has an N_SECT type symbol and a...
authorKevin Enderby <enderby@apple.com>
Wed, 13 Sep 2017 21:01:49 +0000 (21:01 +0000)
committerKevin Enderby <enderby@apple.com>
Wed, 13 Sep 2017 21:01:49 +0000 (21:01 +0000)
commit0833191bf839734e643197b6fce8949c8b7d6473
tree181f0f09e37327b09627f679f0bb52ff37eeb8bc
parent2029d1efeb063352f9e4b1ff4e71b569c1a13eaf
Fix a crash in llvm-nm for a bad Mach-O file that has an N_SECT type symbol and a zero n_sect value.

The code in llvm-nm for Mach-O files to determine the section type for an
N_SECT type symbol it will call getSymbolSection() and check for the error,
but in the case the n_sect value is zero it will return section_end() (aka nullptr).
And the code was using that and crashing instead of just returning a ā€™sā€™ for a
section or printing (?,?) as it would if getSymbolSection() returned an error.

rdar://33136604

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313193 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-nm/X86/Inputs/macho-bad-zero-nsect-for-N_SECT [new file with mode: 0755]
test/tools/llvm-nm/X86/macho-bad-zero-nsect-for-N_SECT.test [new file with mode: 0644]
tools/llvm-nm/llvm-nm.cpp