summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/InputFiles.cpp')
-rw-r--r--lld/ELF/InputFiles.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index cfe8ae74ffa..a0a38de0d8a 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -775,9 +775,18 @@ template <class ELFT> void SharedFile<ELFT>::parseRest() {
// Ignore local symbols.
if (Versym && VersymIndex == VER_NDX_LOCAL)
continue;
-
- const Elf_Verdef *V =
- VersymIndex == VER_NDX_GLOBAL ? nullptr : Verdefs[VersymIndex];
+ const Elf_Verdef *V = nullptr;
+ if (VersymIndex != VER_NDX_GLOBAL) {
+ if (VersymIndex >= Verdefs.size()) {
+ error("corrupt input file: version definition index " +
+ Twine(VersymIndex) + " for symbol " + Name +
+ " is greater than the maximum value " +
+ Twine(Verdefs.size() - 1) + "\n>>> symbol is defined in " +
+ toString(this));
+ continue;
+ }
+ V = Verdefs[VersymIndex];
+ }
if (!Hidden)
Symtab->addShared(Name, this, Sym, V);
OpenPOWER on IntegriCloud