We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xcode 10.1 (10B61)
Swift 4.2
md5: 248cd2ff2bf9232cd0e28d866bb7a58d
Issue Description:
Code compiles, but always throws an exception EXC_BAD_INSTRUCTION
let initialData = Data() var invalidChunk = initialData.dropLast(1) // or prefix(len), suffix(len), dropFirst(k), dropLast(k) print(invalidChunk) // 0 bytes, looks like valid Data let finalMessage = invalidChunk.withUnsafeMutableBytes { (rawTag: UnsafeMutablePointer<UInt8>) -> Data in // EXC_BAD_INSTRUCTION return Data() } print(finalMessage)
Other initialization examples:
let initialData = Data(repeating: 1, count: 2) var invalidChunk = initialData.prefix(0) // or suffix(0)
let initialData = Data(repeating: 1, count: 2) var invalidChunk = initialData.dropFirst(2) // or dropLast(k), k >= 2
Backtrace:
* thread #​1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) * frame #​0: 0x000000010005d569 RawDataTest`Foundation._DataStorage.withUnsafeMutableBytes<A>(in: Swift.Range<Swift.Int>, apply: (Swift.UnsafeMutableRawBufferPointer) throws -> A) throws -> A + 1113 frame #​1: 0x000000010006a11e RawDataTest`Foundation.Data.withUnsafeMutableBytes<A, B>((Swift.UnsafeMutablePointer<B>) throws -> A) throws -> A + 222 frame #​2: 0x000000010000263b RawDataTest`main at main.swift:19 frame #​3: 0x00007fff69a9608d libdyld.dylib`start + 1
The text was updated successfully, but these errors were encountered:
Seems to be fixed in master, but probably worth adding tests for! cc @phausler
Sorry, something went wrong.
No branches or pull requests
Environment
Xcode 10.1 (10B61)
Swift 4.2
Additional Detail from JIRA
md5: 248cd2ff2bf9232cd0e28d866bb7a58d
Issue Description:
Code compiles, but always throws an exception EXC_BAD_INSTRUCTION
Other initialization examples:
Backtrace:
The text was updated successfully, but these errors were encountered: