mirror of
https://github.com/apple/swift-nio
synced 2026-11-28 05:14:23 +00:00
Motivation: ContiguousCollections shouldn't give access to more than `count` bytes via `withUnsafeBytes` but if they do we should still handle this correctly and only copy `count` bytes. Modifications: - copy an upper limit of `count` bytes - fail hard if `withUnsafeBytes` offers fewer bytes as we can't do anything sensible then. Result: even illegal `ContiguousCollection` implementations don't cause issues.