Merge pull request #82720 from al45tair/eng/PR-154837649

[Backtracing][Linux] Ignore `SHT_NULL` sections.
This commit is contained in:
Alastair Houghton
2025-07-08 15:38:15 +01:00
committed by GitHub

View File

@@ -1475,6 +1475,11 @@ final class ElfImage<SomeElfTraits: ElfTraits>
let stringSect = ElfStringSection(source: stringSource)
for shdr in sectionHeaders {
// All other fields are undefined for SHT_NULL
if shdr.sh_type == .SHT_NULL {
continue
}
guard let name = stringSect.getStringAt(index: Int(shdr.sh_name)) else {
continue
}
@@ -1612,6 +1617,11 @@ final class ElfImage<SomeElfTraits: ElfTraits>
let stringSect = ElfStringSection(source: stringSource)
for shdr in sectionHeaders {
// All other fields are undefined for SHT_NULL
if shdr.sh_type == .SHT_NULL {
continue
}
guard let sname
= stringSect.getStringAt(index: Int(shdr.sh_name)) else {
continue