Commit ad1a336
committed
RemoteInspection: Skip unused ELF section headers
ELF section headers are allowed to be left uninitialized when the
section is empty and unused. LLD is a tad more aggressive about this.
The ELF reader in the Swift runtime was a bit aggressive about
converting the section headers to names and would not skip over these
unused sections headers resulting in crashes due to operating on
uninitialized memory in the `sh_name` field.
This patch teaches the ELF reader to skip over unused section header
table entries.
(cherry picked from commit 14d2088)
- Explanation: Fixes a bug where we would read uninitialized data from
unused ELF section headers.
- Scope: Affects ELF-based platforms and ELF file handling in tools
like swift-reflection-dump.
- Risk: Low -- Improves implementation according to the spec.
Any data used from this was garbage anyway.
- Testing: Tested on FreeBSD with LLD, which makes uses of unused
section headers. Ensured that runtime and
swift-reflection-dump don't crash anymore.
- Reviewers: @compnerd, @al45tair
Cherry-Pick: swiftlang#826981 parent 66d905e commit ad1a336
1 file changed
+3
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
638 | 641 | | |
639 | 642 | | |
640 | 643 | | |
| |||
0 commit comments