From 5fecfaadc912ee0388cb9e8683b637399eca7c8a Mon Sep 17 00:00:00 2001 From: George Rimar Date: Tue, 11 Oct 2016 08:12:27 +0000 Subject: [PATCH] Reverted r283740 [Object/ELF] - Do not crash on invalid Header->e_shoff value. Bot does not like it: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/17075 /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Object/invalid.test:70:32: error: expected string not found in input INVALID-SEC-ADDRESS-ALIGNMENT: Invalid address alignment of section headers ^ :1:1: note: scanning from here /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Object/ELF.h:412:7: runtime error: upcast of misaligned address 0x000002d8b899 for type 'llvm::object::Elf_Shdr_Impl >', which requires 2 byte alignment ^ :1:125: note: possible intended match here /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Object/ELF.h:412:7: runtime error: upcast of misaligned address 0x000002d8b899 for type 'llvm::object::Elf_Shdr_Impl >', which requires 2 byte alignment llvm-svn: 283858 --- llvm/include/llvm/Object/ELF.h | 2 -- .../Inputs/invalid-sections-address-alignment.x86-64 | Bin 473 -> 0 bytes llvm/test/Object/invalid.test | 4 ---- 3 files changed, 6 deletions(-) delete mode 100644 llvm/test/Object/Inputs/invalid-sections-address-alignment.x86-64 diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h index 302db65..c06fa75 100644 --- a/llvm/include/llvm/Object/ELF.h +++ b/llvm/include/llvm/Object/ELF.h @@ -367,8 +367,6 @@ const typename ELFFile::Elf_Shdr *ELFFile::section_begin() const { if (Header->e_shentsize != sizeof(Elf_Shdr)) report_fatal_error( "Invalid section header entry size (e_shentsize) in ELF header"); - if (Header->e_shoff & (AlignOf::Alignment - 1)) - report_fatal_error("Invalid address alignment of section headers"); return reinterpret_cast(base() + Header->e_shoff); } diff --git a/llvm/test/Object/Inputs/invalid-sections-address-alignment.x86-64 b/llvm/test/Object/Inputs/invalid-sections-address-alignment.x86-64 deleted file mode 100644 index c0653d1d1b3e249110cef4ae9f212f6022f5f85c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 473 zcmb<-^>JfjWMqH=Mg}_u1P?08%D^xarT|DgfY}ZVtZ_FikK&)4iT2aD~ zmY>g%mzoiuR+Ok$TvAk$n8cu0T$u}`K}--(0Fw+X5Q+>^6sU(8q)!4xvv>uRn~EaL z0QU+^7!(K~%mx#93}M*8_-Hh`OSysaK>Y9%L6XkOgwk)qvzZkQD*h OAblV^IH2M%?*afcSro7U diff --git a/llvm/test/Object/invalid.test b/llvm/test/Object/invalid.test index 1c060f3..9f55874 100644 --- a/llvm/test/Object/invalid.test +++ b/llvm/test/Object/invalid.test @@ -64,7 +64,3 @@ RUN: FileCheck --check-prefix=INVALID-RELOC-SH-OFFSET %s RUN: not llvm-readobj -r %p/Inputs/invalid-relocation-sec-sh_offset.elf-x86-64 2>&1 | \ RUN: FileCheck --check-prefix=INVALID-RELOC-SH-OFFSET %s INVALID-RELOC-SH-OFFSET: Invalid data was encountered while parsing the file - -RUN: not llvm-readobj -t %p/Inputs/invalid-sections-address-alignment.x86-64 2>&1 | \ -RUN: FileCheck --check-prefix=INVALID-SEC-ADDRESS-ALIGNMENT %s -INVALID-SEC-ADDRESS-ALIGNMENT: Invalid address alignment of section headers -- 2.7.4