[lld] ce5de93 - [ELF] Disallow out-of-range section group indices after D70146
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 09:49:55 PST 2019
Author: Fangrui Song
Date: 2019-11-19T09:49:45-08:00
New Revision: ce5de93e838f7391760ba2956c7e0ae5d203cb6f
URL: https://github.com/llvm/llvm-project/commit/ce5de93e838f7391760ba2956c7e0ae5d203cb6f
DIFF: https://github.com/llvm/llvm-project/commit/ce5de93e838f7391760ba2956c7e0ae5d203cb6f.diff
LOG: [ELF] Disallow out-of-range section group indices after D70146
Exposed by invalid/sht-group-wrong-section.test
http://45.33.8.238/win/2613/step_9.txt
Added:
Modified:
lld/ELF/InputFiles.cpp
Removed:
################################################################################
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 0026aeef58db..7dc72361abd7 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -621,6 +621,8 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats) {
InputSectionBase *head;
InputSectionBase *prev = nullptr;
for (uint32_t secIndex : entries.slice(1)) {
+ if (secIndex >= this->sections.size())
+ continue;
InputSectionBase *s = this->sections[secIndex];
if (!s || s == &InputSection::discarded)
continue;
More information about the llvm-commits
mailing list