[PATCH] D41247: Handle a VersymIndex of 0 as an error
Rafael Ávila de Espíndola via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 14 10:04:30 PST 2017
rafael created this revision.
rafael added a reviewer: pcc.
Herald added a subscriber: emaste.
Hi Peter,
I just noticed that the continue this patch deletes was not tested. Trying to add a test I realized that we never put a VER_NDX_LOCAL symbol in the dynamic symbol table. Is there a reason why a linker ever would?
https://reviews.llvm.org/D41247
Files:
ELF/InputFiles.cpp
test/ELF/corrupted-version-reference.s
Index: test/ELF/corrupted-version-reference.s
===================================================================
--- test/ELF/corrupted-version-reference.s
+++ test/ELF/corrupted-version-reference.s
@@ -5,6 +5,9 @@
# CHECK: error: corrupt input file: version definition index 9 for symbol __cxa_finalize is out of bounds
# CHECK: >>> defined in {{.+}}/corrupt-version-reference.so
+# CHECK: error: corrupt input file: version definition index 0 for symbol _Jv_RegisterClasses is out of bounds
+# CHECK-NEXT: >>> defined in {{.*}}/corrupt-version-reference.so
+
.globl __start
__start:
dla $a0, __cxa_finalize
Index: ELF/InputFiles.cpp
===================================================================
--- ELF/InputFiles.cpp
+++ ELF/InputFiles.cpp
@@ -807,12 +807,9 @@
continue;
}
- // Ignore local symbols.
- if (Versym && VersymIndex == VER_NDX_LOCAL)
- continue;
const Elf_Verdef *Ver = nullptr;
- if (VersymIndex != VER_NDX_GLOBAL) {
- if (VersymIndex >= Verdefs.size()) {
+ if (Versym && VersymIndex != VER_NDX_GLOBAL) {
+ if (VersymIndex >= Verdefs.size() || VersymIndex == VER_NDX_LOCAL) {
error("corrupt input file: version definition index " +
Twine(VersymIndex) + " for symbol " + Name +
" is out of bounds\n>>> defined in " + toString(this));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41247.126987.patch
Type: text/x-patch
Size: 1357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171214/67156ed7/attachment-0001.bin>
More information about the llvm-commits
mailing list