Skip to content

Ensure that hashing data with zero bytes avoids empty allocations and fix bridged empty data hashes from de-referencing null values #12509

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
Oct 20, 2017

Conversation

phausler
Copy link
Contributor

With the slice range fixes for data it changed the copy-out mechanism for hashing bridged data references; this caused a regression due to the fact the buffer was potentially allocated with zero bytes as well as the memcpy would be passed a null pointer from NSData for the bytes when the length was zero. This accounts for both problems and adds tests for empty Data (which worked before), empty bridged Data, and empty sliced Data (which also worked previously).

This resolves the following issues:
rdar://problem/35042847

@phausler
Copy link
Contributor Author

@swift-ci please test

@phausler phausler requested a review from itaiferber October 19, 2017 16:37
Copy link
Contributor

@itaiferber itaiferber left a comment

Choose a reason for hiding this comment

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

Yep, seems like a reasonable fix 👍

… fix bridged empty data hashes from de-referencing null values
@phausler phausler force-pushed the empty_data_hashing_fix branch from e0ac356 to b19c01d Compare October 19, 2017 20:46
@phausler
Copy link
Contributor Author

@swift-ci please smoke test

@phausler phausler merged commit b78b438 into swiftlang:master Oct 20, 2017
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