summaryrefslogtreecommitdiffstats
path: root/llvm/test/Object
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-08-07 09:29:42 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-08-07 09:29:42 +0000
commita74aa23065cc456673f2910b3d7d65e5db6da718 (patch)
tree52741f95952c45541c44e415f2303bd0dd9eb1f3 /llvm/test/Object
parentc310992186bd3be12fe6f93522f8124d2a413cf8 (diff)
downloadbcm5719-llvm-a74aa23065cc456673f2910b3d7d65e5db6da718.tar.gz
bcm5719-llvm-a74aa23065cc456673f2910b3d7d65e5db6da718.zip
[ELF.h] - Check the case when e_shstrndx=SHN_XINDEX, but the corresponding sh_link is broken.
When e_shstrndx is equal to SHN_XINDEX, the index of the section string table section should be taken from the sh_link field of the section header at index 0. If sh_link is broken, e.g. contains an index that is larger than number of sections, then error is reported. This error message was untested before. Differential revision: https://reviews.llvm.org/D65391 llvm-svn: 368139
Diffstat (limited to 'llvm/test/Object')
-rw-r--r--llvm/test/Object/invalid.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Object/invalid.test b/llvm/test/Object/invalid.test
index 04a332d5fa4..9086b87dda9 100644
--- a/llvm/test/Object/invalid.test
+++ b/llvm/test/Object/invalid.test
@@ -652,3 +652,23 @@ Sections:
DynamicSymbols:
- Name: foo
Binding: STB_GLOBAL
+
+## Check the case when e_shstrndx == SHN_XINDEX, but null section's sh_link contains
+## the index of a section header string table that is larger than the number of the sections.
+
+# RUN: yaml2obj --docnum=31 %s -o %t31
+# RUN: not llvm-objcopy %t31 2>&1 | FileCheck %s -DFILE=%t31 --check-prefix=INVALID-SHSTRTAB-INDEX
+
+# INVALID-SHSTRTAB-INDEX: error: section header string table index 255 does not exist
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+## SHN_XINDEX == 0xffff.
+ SHStrNdx: 0xffff
+Sections:
+ - Type: SHT_NULL
+ Link: 0xff
OpenPOWER on IntegriCloud