Skip to content

Commit 2d1e4cf

Browse files
neonichuMaxDesiatov
authored andcommitted
load => loadUnaligned (#6929)
This is the potential source of a crash on x86_64 using the rebranch branch of Swift. rdar://115675736
1 parent c1956bc commit 2d1e4cf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Sources/PackagePlugin/Plugin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ internal struct MessageConnection<TX,RX> where TX: Encodable, RX: Decodable {
303303
}
304304

305305
// Decode the count.
306-
let count = header.withUnsafeBytes{ $0.load(as: UInt64.self).littleEndian }
306+
let count = header.withUnsafeBytes{ $0.loadUnaligned(as: UInt64.self).littleEndian }
307307
guard count >= 2 else {
308308
throw PluginMessageError.invalidPayloadSize
309309
}

Sources/Workspace/DefaultPluginScriptRunner.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ fileprivate extension FileHandle {
664664
guard header.count == 8 else {
665665
throw PluginMessageError.truncatedHeader
666666
}
667-
let length = header.withUnsafeBytes{ $0.load(as: UInt64.self).littleEndian }
667+
let length = header.withUnsafeBytes{ $0.loadUnaligned(as: UInt64.self).littleEndian }
668668
guard length >= 2 else {
669669
throw PluginMessageError.invalidPayloadSize
670670
}

0 commit comments

Comments
 (0)