Open martinr448 opened 5 years ago
Hmm this seems to crash in `public subscript(i: Index) -> Character {}` in `Substring.swift`. When I print the start and end indices of `rev`, then I get empty indices. Printing random elements works but fails when printing the newline character with the same crash. Reversing `rev` and creating a String works as well.
range(of:)
is implemented in terms of NSString and thus doesn't understand grapheme clusters. :-( cc @milseman
Environment
Tested with Xcode 10.1 (Swift 4.2) and Xcode 10.2 beta 3 (Swift 5).Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Standard Library | |Labels | Bug, RunTimeCrash | |Assignee | None | |Priority | Medium | md5: 9ba13aeb1c246a44632281938881173bIssue Description:
Iterating over a
ReversedCollection<String.SubSequence>
can crash if the substring starts within an extended grapheme cluster:The same crash happens with any of the following: