You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-7849DataStorage's get(:) method should use load(fromByteOffset:as:)
SR-7726 Data.withUnsafe(Mutable)Bytes should use bindMemory(to:) instead of assumingMemoryBound(to:)
Issue Description:
Currently _DataStorage's set(_:) method uses assumingMemoryBound(to:), which can invoke undefined behaviour if the underlying memory is bound to a type unrelated to UInt8.
We should use storeBytes(of:toByteOffset:as:) instead.
Additional Detail from JIRA
md5: c7b57e6b7c36a5f0a52076e6c5231d17
relates to:
Issue Description:
Currently
_DataStorage
'sset(_:)
method usesassumingMemoryBound(to:)
, which can invoke undefined behaviour if the underlying memory is bound to a type unrelated toUInt8
.We should use
storeBytes(of:toByteOffset:as:)
instead.For more context, see https://forums.swift.org/t/how-to-use-data-withunsafebytes-in-a-well-defined-manner/12811.
The text was updated successfully, but these errors were encountered: