Skip to content

Commit ce5de93

Browse files
committed
[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
1 parent 1d943ae commit ce5de93

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lld/ELF/InputFiles.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,8 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats) {
621621
InputSectionBase *head;
622622
InputSectionBase *prev = nullptr;
623623
for (uint32_t secIndex : entries.slice(1)) {
624+
if (secIndex >= this->sections.size())
625+
continue;
624626
InputSectionBase *s = this->sections[secIndex];
625627
if (!s || s == &InputSection::discarded)
626628
continue;

0 commit comments

Comments
 (0)