New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-3667] Crash in CharacterSet #4295
Comments
Comment by Nathaniel Bomberger (JIRA) Some observations that may be helpful: I was able to reproduce this bug intermittently. For example, it seemed if I restarted playground and enterered in your code, it would occur. If I changed the characters, it might crash at first, then it would work, however, then it would seem to work correctly after deleting some text in playground. It felt very racy.. or perhaps some underlying memory mishandle? it should be noted I am on the Xcode 8.3.2, Swift 3.1. Sierra 10.12.5, and it still exists. |
I'm thinking it's a memory error, because I intermittently get either crashes or incorrect results with the following code, but it reliably crashes once I turn Guard Malloc on: {code:none}import Foundation let charset1 = CharacterSet(charactersIn: "abc") // returns 'false' with Guard Malloc off, crashes with Guard Malloc on |
Also, this workaround seems to work: copy the charsets so that they become good old C/ObjC __NSCFCharacterSets instead of _SwiftNSCharacterSet, and then use CoreFoundation to prevent the bridge from bringing things back:
|
Attachment: Download
Environment
Xcode 8.2
macOS 10.12.2
Additional Detail from JIRA
md5: 6883edae0bb5e9e44b987df04957b303
Issue Description:
There is a crash in the CharacterSet implementation. See the example below. I've attached a Playground with this issue and a screenshot of the error.
The text was updated successfully, but these errors were encountered: