Skip to content

[Reflection] Bounds-check vector creation in createBoundGenericTypeReconstructingParent. #62485

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
Dec 12, 2022

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Dec 9, 2022

If argsIndex or numGenericsArgs were out of bounds, we'd end up reading off the beginning or end of the args ArrayRef, resulting in memory allocation failures, segfaults, or reading garbage data. Check that we're reading within the bounds of the array, and fail gracefully if not.

rdar://103142856

…constructingParent.

If argsIndex or numGenericsArgs were out of bounds, we'd end up reading off the beginning or end of the args ArrayRef, resulting in memory allocation failures, segfaults, or reading garbage data. Check that we're reading within the bounds of the array, and fail gracefully if not.

rdar://103142856
@mikeash mikeash requested a review from al45tair December 9, 2022 19:10
@mikeash
Copy link
Contributor Author

mikeash commented Dec 10, 2022

@swift-ci please test

Copy link
Contributor

@al45tair al45tair left a comment

Choose a reason for hiding this comment

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

Do we want to log some kind of error when the bounds check fails?

@mikeash
Copy link
Contributor Author

mikeash commented Dec 12, 2022

Discussed offline, but repeating here for posterity: this is a somewhat-expected condition (because we'll inevitably encounter bad data in the target process) so we don't want to clutter up the program's output with non-fatal error messages. Ideally we'd return an error to the caller, but that's a much more extensive change to consider later.

@mikeash
Copy link
Contributor Author

mikeash commented Dec 12, 2022

@swift-ci please smoke test

@mikeash mikeash merged commit 7c6fea6 into swiftlang:main Dec 12, 2022
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