-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[5.1][Runtime] Fix swift_conformsToProtocol crashing on conformances to unavailable classes. #26649
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
[5.1][Runtime] Fix swift_conformsToProtocol crashing on conformances to unavailable classes. #26649
Conversation
…available classes. An extension on a class creates a conformance record that's always visible even when that class is not present at runtime. In that case, the type pointer in the conformance record is NULL. The runtime did not like this, and crashed. This fixes it to ignore such records instead. rdar://problem/54054895
Add code to the 5.0 compatibility library that scans for conformances pointing to a NULL type and rewrites them to point to a dummy type that the 5.0 protocol conformance checking code will safely ignore.
@swift-ci please test |
Build failed |
@swift-ci please test |
Build failed |
Build failed |
@swift-ci test |
Build failed |
Build failed |
8815ac0
to
7ca665b
Compare
@swift-ci please test |
Build failed |
Build failed |
Cherry-pick #26638 to 5.1.
An extension on a class creates a conformance record that's always visible even when that class is not present at runtime. In that case, the type pointer in the conformance record is NULL. The runtime did not like this, and crashed. This fixes it to ignore such records instead.
For back deployment to Swift 5.0, the swiftCompatibility50 library is extended to find conformance records with NULL type pointers and rewrite those pointers to point to a dummy type that will be ignored by the runtime.
rdar://problem/54054895