llvm-project/llvm/test/tools/llvm-objdump/X86/Inputs
Michael Trent 7dcfac6171 objdump fails to parse Mach-O binaries with n_desc bearing stabs
Summary:
The objdump Mach-O parser uses MachOObjectFile::checkSymbolTable() to
verify the symbol table is in a legal state before dereferencing the
offsets in the table. This routine missed a test for N_STAB symbols
when validating the two-level name space library ordinal for undefined
symbols. If the binary in question contained a value in the n_desc high
byte that is larger than the list of loaded dylibs, checkSymbolTable()
will flag the library ordinal as being out of range. Most of the time
the n_desc field is set to 0 or to small values, but old final linked
binaries exist with N_STAB symbols bearing non-trivial n_desc fields. 

The change here is simply to verify a symbol is not an N_STAB symbol
before consulting the values of n_other or n_desc.

rdar://44977336

Reviewers: lhames, pete, ab

Reviewed By: pete

Subscribers: llvm-commits, rupprecht

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D58568

llvm-svn: 354722
2019-02-23 06:19:56 +00:00
..
malformed-machos
ObjC.exe.macho-x86_64
ObjC.obj.macho-x86_64
Objc1.32bit.exe.macho-i386
Objc1.32bit.obj.macho-i386
Objc2.32bit.exe.macho-i386
Objc2.32bit.obj.macho-i386
Objc2.64bit.exe.macho-x86_64
Objc2.64bit.obj.dylib-x86_64
Objc2.64bit.obj.macho-x86_64
codesig.macho-x86_64
debug-info-fileinfo.exe.elf-x86_64
disassemble-data.obj
disassemble.dll.coff-i386
dylibLoadKinds.macho-x86_64
dylibModInit.macho-x86_64
dylibRoutines.macho-x86_64
dylibSubClient.macho-x86_64
dylibSubFramework.macho-x86_64
dylibSubLibrary.macho-x86_64
dylibSubUmbrella.macho-x86_64
exeThread.macho-x86_64
hello.exe.elf-i386
hello.exe.macho-i386
hello.exe.macho-x86_64
hello.exe.nopie.elf-i386
hello.exe.stripped.macho-x86_64
hello.obj.macho-i386
hello.obj.macho-x86_64
hello_cpp.exe.macho-x86_64
internal.exe.coff-x86_64
kextbundle.macho-x86_64
linkerOption.macho-x86_64
macho-disassemble-stab-x86_64 objdump fails to parse Mach-O binaries with n_desc bearing stabs 2019-02-23 06:19:56 +00:00
macho-invalid-bind-entry
macho-invalid-reloc-section-index
macho-invalid-symbol-indr
macho-invalid-symbol-indr-archive-universal
macho-invalid-symbol-lib_ordinal
macho-invalid-symbol-nsect
macho-invalid-symbol-nsect-archive
macho-invalid-symbol-strx
macho-invalid-symbol-strx-universal
macho-multiple-text
macho-preload-x86_64
macho-universal-archive.x86_64.i386
macho-universal.x86_64.i386
macho-universal64.x86_64.i386
nofirst-symbol.macho-x86_64
note.macho-x86
objModInit.macho-x86_64
openbsd-phdrs.elf-x86-64
out-of-section-sym.elf-i386
phdr-note.elf-x86-64
phdrs.elf-x86-64
simple-executable-x86_64.yaml
source-interleave-x86_64.c
stripped-elf.so
stub-nosyms.macho-x86_64
stubbed.dylib.macho-x86_64
thread.macho-i386
trivial.obj.elf-i386
truncated-section.dylib.macho-x86_64