Skip to content

Conversation

@Catfish-Man
Copy link
Contributor

5.1 version of #25866

(cherry picked from commit 27359bd)

Fixes rdar://problem/52565005

Explanation: CFString removes UTF8 byte order marks on creation, which we do when bridging SmallStrings. This means that bridging SmallStrings will unexpectedly reduce the length of the resulting NSString, resulting in out of index crashes and so on.

Scope: Swift Standard Library

Issue: rdar://problem/52565005

Risk: Low. This is a change of behavior, but it's restoring 4.2 behavior; additionally it only comes into effect in edge cases, since byte order marks are discouraged in UTF8 content.

Testing: Regular tests + new automated tests specifically for this issue

Reviewer: @milseman

…creating CFStrings. This gets consistent behavior with non-smol Strings when the String contains a BOM

(cherry picked from commit 27359bd)
@Catfish-Man Catfish-Man self-assigned this Jul 3, 2019
@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@Catfish-Man
Copy link
Contributor Author

@swift-ci nominate

@Catfish-Man Catfish-Man merged commit d2c038e into swiftlang:swift-5.1-branch Jul 3, 2019
Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants