llvm.org GIT mirror llvm / 1390211
[Object/ELF] - Avoid possible crash in getExtendedSymbolTableIndex(). When using broken input object found using AFL, getExtendedSymbolTableIndex() crashed because ShndxTable was empty as object does not contain SHT_SYMTAB_SHNDX section. Differential revision: https://reviews.llvm.org/D25189 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283196 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 3 years ago
3 changed file(s) with 6 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
224224 ArrayRef ShndxTable) const {
225225 assert(Sym->st_shndx == ELF::SHN_XINDEX);
226226 unsigned Index = Sym - FirstSym;
227
227 if (Index >= ShndxTable.size())
228 report_fatal_error("Invalid symbol table index");
228229 // The size of the table was checked in getSHNDXTable.
229230 return ShndxTable[Index];
230231 }
5353
5454 RUN: not llvm-readobj -t %p/Inputs/invalid-xindex-size.elf 2>&1 | FileCheck --check-prefix=INVALID-XINDEX-SIZE %s
5555 INVALID-XINDEX-SIZE: Invalid data was encountered while parsing the file.
56
57 RUN: not llvm-readobj -t %p/Inputs/invalid-ext-symtab-index.elf-x86-64 2>&1 | \
58 RUN: FileCheck --check-prefix=INVALID-EXT-SYMTAB-INDEX %s
59 INVALID-EXT-SYMTAB-INDEX: Invalid symbol table index