Skip to content

Commit 210eae4

Browse files
authored
Merge pull request swiftlang#82720 from al45tair/eng/PR-154837649
[Backtracing][Linux] Ignore `SHT_NULL` sections.
2 parents a30ed9e + fbd8759 commit 210eae4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

stdlib/public/RuntimeModule/Elf.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,11 @@ final class ElfImage<SomeElfTraits: ElfTraits>
14751475
let stringSect = ElfStringSection(source: stringSource)
14761476

14771477
for shdr in sectionHeaders {
1478+
// All other fields are undefined for SHT_NULL
1479+
if shdr.sh_type == .SHT_NULL {
1480+
continue
1481+
}
1482+
14781483
guard let name = stringSect.getStringAt(index: Int(shdr.sh_name)) else {
14791484
continue
14801485
}
@@ -1612,6 +1617,11 @@ final class ElfImage<SomeElfTraits: ElfTraits>
16121617
let stringSect = ElfStringSection(source: stringSource)
16131618

16141619
for shdr in sectionHeaders {
1620+
// All other fields are undefined for SHT_NULL
1621+
if shdr.sh_type == .SHT_NULL {
1622+
continue
1623+
}
1624+
16151625
guard let sname
16161626
= stringSect.getStringAt(index: Int(shdr.sh_name)) else {
16171627
continue

0 commit comments

Comments
 (0)