Fix a bug in llvm-obdump(1) with the -objc-meta-data flag with -macho

which caused a hang on a malformed binary with bad bind info.

rdar://29672108


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294021 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby 2017-02-03 18:22:04 +00:00
parent da9f518360
commit b6a21d0438
3 changed files with 4 additions and 1 deletions

View File

@ -63,3 +63,6 @@ INVALID-SYMBOL-STRX-UNIVERSAL: macho-invalid-symbol-strx-universal' (for archite
RUN: not llvm-objdump -macho -disassemble %p/Inputs/macho-invalid-symbol-lib_ordinal 2>&1 | FileCheck -check-prefix INVALID-SYMBOL-LIB_ORDINAL %s
INVALID-SYMBOL-LIB_ORDINAL: macho-invalid-symbol-lib_ordinal': truncated or malformed object (bad library ordinal: 7 for symbol at index 2)
RUN: llvm-objdump -macho -objc-meta-data %p/Inputs/macho-invalid-bind-entry | FileCheck -check-prefix INVALID-BIND-ENTRY %s
INVALID-BIND-ENTRY: 0000000100020c90 0x2d0409887202e473

View File

@ -9579,7 +9579,7 @@ static const char *get_dyld_bind_info_symbolname(uint64_t ReferenceValue,
uint32_t SegIndex = Entry.segmentIndex();
uint64_t OffsetInSeg = Entry.segmentOffset();
if (!sectionTable.isValidSegIndexAndOffset(SegIndex, OffsetInSeg))
continue;
return nullptr;
uint64_t Address = sectionTable.address(SegIndex, OffsetInSeg);
StringRef name = Entry.symbolName();
if (!name.empty())