[PATCH] D65391: [ELF.h] - Check the case when e_shstrndx=SHN_XINDEX, but the corresponding sh_link is broken.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 31 08:11:15 PDT 2019
grimar updated this revision to Diff 212584.
grimar marked an inline comment as done.
grimar edited the summary of this revision.
grimar added a comment.
- Addressed comments.
James, since this is independent from D65388 <https://reviews.llvm.org/D65388>,
are you OK to land it?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65391/new/
https://reviews.llvm.org/D65391
Files:
include/llvm/Object/ELF.h
test/Object/invalid.test
Index: test/Object/invalid.test
===================================================================
--- test/Object/invalid.test
+++ test/Object/invalid.test
@@ -627,3 +627,23 @@
Content: ""
Symbols:
- Name: foo
+
+## Check the case when e_shstrndx == SHN_XINDEX, but sh_link in the section header at index 0
+## contains index of section header string table that is larger than number of the sections.
+
+# RUN: yaml2obj --docnum=30 %s -o %t30
+# RUN: not llvm-objcopy %t30 2>&1 | FileCheck %s -DFILE=%t30 --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
Index: include/llvm/Object/ELF.h
===================================================================
--- include/llvm/Object/ELF.h
+++ include/llvm/Object/ELF.h
@@ -466,7 +466,6 @@
if (!Index) // no section string table.
return "";
- // TODO: Test a case when the sh_link of the section with index 0 is broken.
if (Index >= Sections.size())
return createError("section header string table index " + Twine(Index) +
" does not exist");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65391.212584.patch
Type: text/x-patch
Size: 1330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190731/0e695fc2/attachment.bin>
More information about the llvm-commits
mailing list