diff options
author | George Rimar <grimar@accesssoftek.com> | 2016-10-10 10:51:38 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2016-10-10 10:51:38 +0000 |
commit | e4dce5ce3eccc0e9edc67a7aef46e5aebc7dda03 (patch) | |
tree | ba002bb78159f623ec4be7313f56d5ab31872033 /llvm/test/Object/invalid.test | |
parent | 2e2c24d2b253902908b65c7ae5245a1a666b18b2 (diff) | |
download | bcm5719-llvm-e4dce5ce3eccc0e9edc67a7aef46e5aebc7dda03.tar.gz bcm5719-llvm-e4dce5ce3eccc0e9edc67a7aef46e5aebc7dda03.zip |
[Object/ELF] - Do not crash on invalid Header->e_shoff value.
sections_begin() may return unalignment pointer when Header->e_shoff isinvalid.
That may result in a crash in clients, for example we have one in LLD:
assert((PtrWord & ~PointerBitMask) == 0 &&
"Pointer is not sufficiently aligned");
fails when trying to push_back Elf_Shdr* (unaligned) into TinyPtrVector.
Patch forces check for alignment of Header->e_shoff.
Differential revision: https://reviews.llvm.org/D25368
llvm-svn: 283740
Diffstat (limited to 'llvm/test/Object/invalid.test')
-rw-r--r-- | llvm/test/Object/invalid.test | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/test/Object/invalid.test b/llvm/test/Object/invalid.test index 9f5587422d1..1c060f3e6fc 100644 --- a/llvm/test/Object/invalid.test +++ b/llvm/test/Object/invalid.test @@ -64,3 +64,7 @@ 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 |