]> granicus.if.org Git - llvm/commitdiff
Revert r285285 "[Object/ELF] - Fixed behavior when SectionHeaderTable->sh_size is...
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 27 Oct 2016 12:18:50 +0000 (12:18 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 27 Oct 2016 12:18:50 +0000 (12:18 +0000)
It broke BB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285288 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Object/ELF.h
test/Object/Inputs/invalid-sections-num.elf [deleted file]
test/Object/invalid.test

index 2c715bffa2fdfc9922c1c05e7d07422c8a72b28a..d1de25d2821904abea4546d47d901d6c61736453 100644 (file)
@@ -347,12 +347,6 @@ ELFFile<ELFT>::ELFFile(StringRef Object, std::error_code &EC)
   // The getNumSections() call below depends on SectionHeaderTable being set.
   SectionHeaderTable =
     reinterpret_cast<const Elf_Shdr *>(base() + SectionTableOffset);
-  if (getNumSections() > UINT64_MAX / Header->e_shentsize) {
-    // Section table goes past end of file!
-    EC = object_error::parse_failed;
-    return;
-  }
-
   const uint64_t SectionTableSize = getNumSections() * Header->e_shentsize;
 
   if (SectionTableOffset + SectionTableSize > FileSize) {
diff --git a/test/Object/Inputs/invalid-sections-num.elf b/test/Object/Inputs/invalid-sections-num.elf
deleted file mode 100644 (file)
index d8d5bc8..0000000
Binary files a/test/Object/Inputs/invalid-sections-num.elf and /dev/null differ
index dd431aa3a55e41acacaddb266888d03402a2336d..a0016fef9d537cc00eda61ecf3564a59f700e5d4 100644 (file)
@@ -76,6 +76,3 @@ INVALID-SEC-ADDRESS-ALIGNMENT: Invalid data was encountered while parsing the fi
 RUN: not llvm-readobj -t %p/Inputs/invalid-section-size2.elf 2>&1 | \
 RUN:   FileCheck --check-prefix=INVALID-SECTION-SIZE2 %s
 INVALID-SECTION-SIZE2: Invalid data was encountered while parsing the file.
-
-RUN: not llvm-readobj -t %p/Inputs/invalid-sections-num.elf 2>&1 | FileCheck --check-prefix=INVALID-SECTION-NUM %s
-INVALID-SECTION-NUM: Invalid data was encountered while parsing the file.