Closed lorentey closed 6 years ago
@swift-ci create
Regardless of whether we support more than 2^32-length graphemes we should give a better trap message to users
The grapheme clusters here are quite boring – they're just two scalars wide; however, we used to pass the entire string to ICU, and that failed if the string itself is longer than 2^32 code units.
We fixed this as part of the String overhaul, which has long since landed on master and is included in 4.2. (We now pass a slice of the string that's no more than what ICU can process. We still won't process ridiculously long grapheme clusters correctly, but at least we won't crash.)
Environment
Apple Swift version 4.0.1 (swiftlang-902.0.18 clang-902.0.15.1)Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Standard Library | |Labels | Bug | |Assignee | @lorentey | |Priority | Medium | md5: 9399e318128c81acd7eaf2b5e849882bIssue Description:
The following little program creates a huge string and tries to print its first extended grapheme cluster.
I expect the program to print "ő"; unfortunately, instead it crashes on an integer overflow:
Grapheme breaking is delegated to ICU in this case, and ICU's break iterators use 32-bit offsets.