Crash in non-contiguous UTF-8 string in iOS 15.4.0 beta

I am seeing a crash here when calling myString.last on a particular non-contiguous UTF-8 string ("किफायती मूल्य"). Calling makeContiguousUTF8() on the string before calling last works around the issue. I am only seeing this behavior in the iOS 15.4.0 beta. This feels like a Swift-level or iOS-level bug to me, but I'm curious to know more. I submitted the issue via the Feedback Assistant but also wanted to post here in case it is helpful.

2 Likes

Thanks for the report. I believe @Alejandro just put up a fix for this here.

(note, strictly speaking bug is in the standard library, which isn't a "core" library... confusing I know)

2 Likes

Yes, Alejandro's change fixes this.

1 Like