Skip to content
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

Runtime: Make swift_getObjCClassMetadata resilient against weakly linked classes #5055

Conversation

aschwaighofer
Copy link
Member

Description: Whenever we would link against a swift overlay (like CallKit) that has weakly linked Objective-C classes we run the risk of crashing in runtime functions that access type metadata.
The type metadata is initiatialized with swift_getObjCClassMetadata. If the class is weakly linked and not present this function is called with a null (the weakly linked) class.
For example, we crash on iOS9 on a simple “print(“foo”)” call when this application links against CallKit.

Scope: At least three bug reports so far.

Risk: Very low, the fix is to return null if the class passed is null.

Tested: Verified that the reported crashers work after this change

Radar: rdar://problem/28203571 (also rdar://problem/28340074)

Reviewed by: Joe Groff

rdar://28203571

@aschwaighofer
Copy link
Member Author

@swift-ci Please test os x platform

@aschwaighofer aschwaighofer added this to the Swift 3.0 milestone Sep 28, 2016
@tkremenek tkremenek merged commit 9c73778 into apple:swift-3.0-branch Sep 29, 2016
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.

None yet

2 participants