Skip to content

Prevent crash when bridging an invalid CFURL to Swift URL #993

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

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

jrflat
Copy link
Contributor

@jrflat jrflat commented Oct 21, 2024

Bridging an invalid CFURL like https://2001:db8::1:433 to URL in Swift causes a crash since the Swift parser returns nil. For compatibility, we can allow bridging to proceed by storing the string in a URLParseInfo with all nil ranges. This prevents the crash and allows URL to be a dummy container for the string, but otherwise will not return info that may be ambiguous.

@jrflat
Copy link
Contributor Author

jrflat commented Oct 21, 2024

@swift-ci please test

@jrflat jrflat requested a review from parkera October 21, 2024 03:36
Copy link
Contributor

@parkera parkera left a comment

Choose a reason for hiding this comment

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

Let's cherry pick to release/6.0 as well

@jrflat jrflat merged commit efdf0f3 into swiftlang:main Oct 21, 2024
3 checks passed
jrflat added a commit to jrflat/swift-foundation that referenced this pull request Oct 25, 2024
cthielen pushed a commit to cthielen/swift-foundation that referenced this pull request Nov 8, 2024
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