git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240944
91177308-0d34-0410-b5e6-
96231b3b80d8
template <class ELFT>
ErrorOr<StringRef> ELFFile<ELFT>::getString(const Elf_Shdr *Section,
ELF::Elf32_Word Offset) const {
- assert(Section && Section->sh_type == ELF::SHT_STRTAB && "Invalid section!");
+ if (Section->sh_type != ELF::SHT_STRTAB)
+ return object_error::parse_failed;
if (Offset >= Section->sh_size)
return object_error::parse_failed;
return StringRef((const char *)base() + Section->sh_offset + Offset);
RUN: not llvm-dwarfdump %p/Inputs/invalid-bad-rel-type.elf 2>&1 | FileCheck %s
+RUN: not llvm-objdump -s %p/Inputs/invalid-strtab-type.elf 2>&1 | FileCheck %s
CHECK: Invalid data was encountered while parsing the file