mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This fix updates various initializers to handle incoming empty buffers that happen to have a nil base. They should simply create another buffer with nil base rather than crashing! It is valid for an Unsafe[Raw]BufferPointer can have a nil base address. This allows round-tripping with C code that takes a pointer/length pair and uses `0` as the pointer value. The original design wrongly assumed that we would use a sentinel value for empty buffers and was never updated for or tested with the current design. Fixes <rdar://problem/47946984> Regression in Foundation.Data's UnsafeBufferPointer constructor.
17 KiB
17 KiB