Skip to content

Commit d19a98d

Browse files
committed
Don't load older MetadataSections instances
1 parent 8b37036 commit d19a98d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/Testing/Discovery+Platform.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ private func _testContentSectionBounds() -> [SectionBounds] {
9898

9999
withUnsafeMutablePointer(to: &result) { result in
100100
swift_enumerateAllMetadataSections({ sections, context in
101+
let version = sections.load(as: UInt.self)
102+
guard version >= 4 else {
103+
// This structure is too old to contain the swift5_tests field.
104+
return true
105+
}
106+
101107
let sections = sections.load(as: MetadataSections.self)
102108
let result = context.assumingMemoryBound(to: [SectionBounds].self)
103109

0 commit comments

Comments
 (0)