mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
stdlib/String.UnicodeScalarView: fix out-of-bounds read of the
underlying NSString when it ends in a high-surrogate code unit The tests did not catch this because they were creating CFString, which, as it turns out, does not perform bounds checking. Replaced the use of CFString with a custom NSString subclass. Swift SVN r19329
This commit is contained in:
@@ -31,6 +31,9 @@ extension String {
|
||||
base = core
|
||||
}
|
||||
mutating func next() -> UTF16.CodeUnit? {
|
||||
if idx == base.endIndex {
|
||||
return .None
|
||||
}
|
||||
return self.base[idx++]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user