From: Alexey Samsonov Date: Thu, 4 Jun 2015 23:58:31 +0000 (+0000) Subject: Revert "[Object, ELF] Fix segmentation fault in ELFFile::getSectionName()." X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=85529a57b457a7ac8cf498da7ce07acb92d4be37;p=oota-llvm.git Revert "[Object, ELF] Fix segmentation fault in ELFFile::getSectionName()." This reverts commit r239124. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239125 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h index bca09bf7208..e87737dcce7 100644 --- a/include/llvm/Object/ELF.h +++ b/include/llvm/Object/ELF.h @@ -928,7 +928,7 @@ ErrorOr ELFFile::getSymbolName(const Elf_Shdr *Section, template ErrorOr ELFFile::getSectionName(const Elf_Shdr *Section) const { - if (!dot_shstrtab_sec || Section->sh_name >= dot_shstrtab_sec->sh_size) + if (Section->sh_name >= dot_shstrtab_sec->sh_size) return object_error::parse_failed; return StringRef(getString(dot_shstrtab_sec, Section->sh_name)); } diff --git a/test/DebugInfo/Inputs/invalid.elf.no-shstrtab b/test/DebugInfo/Inputs/invalid.elf.no-shstrtab deleted file mode 100644 index e5996951fb1..00000000000 Binary files a/test/DebugInfo/Inputs/invalid.elf.no-shstrtab and /dev/null differ diff --git a/test/DebugInfo/dwarfdump-invalid.test b/test/DebugInfo/dwarfdump-invalid.test index 4236d4f85e4..da5b23e30ce 100644 --- a/test/DebugInfo/dwarfdump-invalid.test +++ b/test/DebugInfo/dwarfdump-invalid.test @@ -4,6 +4,3 @@ RUN: llvm-dwarfdump %p/Inputs/invalid.elf 2>&1 | FileCheck %s --check-prefix=INV RUN: llvm-dwarfdump %p/Inputs/invalid.elf.2 2>&1 | FileCheck %s --check-prefix=INVALID-ELF RUN: llvm-dwarfdump %p/Inputs/invalid.elf.3 2>&1 | FileCheck %s --check-prefix=INVALID-ELF INVALID-ELF: Invalid data was encountered while parsing the file - -RUN: llvm-dwarfdump %p/Inputs/invalid.elf.no-shstrtab 2>&1 | FileCheck %s --check-prefix=EMPTY -EMPTY: .debug_info contents: