[SR-6549] Slice<UnsafeMutableBufferPointer<T>> allows out-of-range assignment #49099
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
master and Swift 4.0.3, macOS
Additional Detail from JIRA
md5: 02617406969a7114543e231ac86fb9ae
Issue Description:
A Slice to an UnsafeMutableBufferPointer can be used to assign to memory locations "outside" of the Slice:
This is probably the expected behaviour in release (-O) mode, but it's strange in debug mode. The reason is that UMBP's _failEarlyRangeCheck methods are empty, and Slice's _failEarlyRangeCheck forwards to its Base's implementation.
Could it be acceptable to introduce _debugPreconditions in UMBP's _failEarlyRangeCheck?
The text was updated successfully, but these errors were encountered: