mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
A collection whose count changes between traversals could cause a memory safety problem, as we would measure the collection in one pass and assume that it was the same length when actually initializing array elements. Fix that by always using the initial measurement, which corresponds exactly to allocated memory. If the collection wants to trap because we've gone past its new bounds, that's fine. If it doesn't, at least we haven't done anything unsafe. Swift SVN r22152
15 KiB
15 KiB