Skip to content

[clang][Index] Add guard to IndexUnitReader module name reading #1921

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

Conversation

bnbarham
Copy link

@bnbarham bnbarham commented Oct 8, 2020

Check that ModuleNamesBuffer is valid before attempting to read strings
from it to avoid possible segfaults. Wasn't able to come up with a test
case, but this does happen based on reported crashes.

Also use StringRef.substr, which returns an empty string if the index is
out of bounds, for even further safety.

Resolves rdar://69809414

Check that ModuleNamesBuffer is valid before attempting to read strings
from it to avoid possible segfaults. Wasn't able to come up with a test
case, but this does happen based on reported crashes.

Also use StringRef.substr, which returns an empty string if the index is
out of bounds, for even further safety.

Resolves rdar://69809414
@bnbarham bnbarham requested a review from akyrtzi October 8, 2020 01:02
@bnbarham
Copy link
Author

bnbarham commented Oct 8, 2020

@swift-ci please test OS X platform

@bnbarham bnbarham merged commit c17f50a into swiftlang:apple/stable/20200714 Oct 8, 2020
@bnbarham bnbarham deleted the benb/cherry-pick-b89f7e8 branch October 8, 2020 03:21
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