Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ELF] Check if LinkSec is nullptr when initializing SHF_LINK_ORDER se…
…ctions Summary: This protects lld from a null pointer dereference when a faulty input file has such invalid sh_link fields. Reviewers: ruiu, espindola Reviewed By: ruiu Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D51743 llvm-svn: 341611
- Loading branch information
Showing
2 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# REQUIRES: x86 | ||
# RUN: yaml2obj %s -o %t.o | ||
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s | ||
# CHECK: invalid sh_link index: 0 | ||
|
||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
Type: ET_REL | ||
Machine: EM_X86_64 | ||
Sections: | ||
- Name: .linkorder | ||
Type: SHT_PROGBITS | ||
Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_LINK_ORDER ] | ||
Link: 0 |