Skip to content

Sema: Fix null dereference in overApproximateAvailabilityAtLocation() #72742

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
Apr 1, 2024

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Apr 1, 2024

The TypeRefinementContext::findMostRefinedSubContext() method can return nullptr in some circumstances, which means that callers need to check the result before dereferencing it in order to avoid a crash. I haven't introduced a test case because I can only reproduce the circumstances under which findMostRefinedSubContext() returns nullptr with a specific project that is exercising a bug in Swift macros. The fix here is obvious enough hardening, though.

Resolves rdar://125054962

The `TypeRefinementContext::findMostRefinedSubContext()` method can return
`nullptr` in some circumstances, which means that callers need to check the
result before dereferencing it in order to avoid a crash. I haven't introduced
a test case because I can only reproduce the circumstances under which
`findMostRefinedSubContext()` returns `nullptr` with a specific project that is
exercising a bug in Swift macros. The fix here is obvious enough hardening,
though.

Resolves rdar://125054962
@tshortli
Copy link
Contributor Author

tshortli commented Apr 1, 2024

@swift-ci please smoke test

@tshortli tshortli enabled auto-merge April 1, 2024 17:19
@tshortli tshortli merged commit 375db9d into swiftlang:main Apr 1, 2024
@tshortli tshortli deleted the null-type-refinement-context branch April 1, 2024 20:56
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.

1 participant