{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift/issues/12511","repository_url":"https://api.github.com/repos/apple/swift","labels_url":"https://api.github.com/repos/apple/swift/issues/12511/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift/issues/12511/comments","events_url":"https://api.github.com/repos/apple/swift/issues/12511/events","html_url":"https://github.com/apple/swift/pull/12511","id":266961799,"number":12511,"title":"Ensure that hashing data with zero bytes avoids empty allocations and fix bridged empty data hashes from de-referencing null values","user":{"login":"phausler","id":278470,"avatar_url":"https://avatars1.githubusercontent.com/u/278470?v=4","gravatar_id":"","url":"https://api.github.com/users/phausler","html_url":"https://github.com/phausler","followers_url":"https://api.github.com/users/phausler/followers","following_url":"https://api.github.com/users/phausler/following{/other_user}","gists_url":"https://api.github.com/users/phausler/gists{/gist_id}","starred_url":"https://api.github.com/users/phausler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phausler/subscriptions","organizations_url":"https://api.github.com/users/phausler/orgs","repos_url":"https://api.github.com/users/phausler/repos","events_url":"https://api.github.com/users/phausler/events{/privacy}","received_events_url":"https://api.github.com/users/phausler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-19T19:33:32Z","updated_at":"2017-10-19T19:33:43Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/12511","html_url":"https://github.com/apple/swift/pull/12511","diff_url":"https://github.com/apple/swift/pull/12511.diff","patch_url":"https://github.com/apple/swift/pull/12511.patch"},"body":"Explanation:\r\nWith 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).\r\n\r\nScope:\r\nThis only applies to the hashing of empty Data objects\r\n\r\nRadar (and possibly SR Issue):\r\nrdar://problem/32359974\r\n\r\nRisk:\r\nOverall the code risk here is low since it restricts to the empty cases and allocates one byte extra of space (to avoid zero allocations).\r\n\r\nTesting:\r\nAdditional unit tests were added to validate the correctness of this patch."},"comment":{"url":"https://api.github.com/repos/apple/swift/issues/comments/338013376","html_url":"https://github.com/apple/swift/pull/12511#issuecomment-338013376","issue_url":"https://api.github.com/repos/apple/swift/issues/12511","id":338013376,"user":{"login":"phausler","id":278470,"avatar_url":"https://avatars1.githubusercontent.com/u/278470?v=4","gravatar_id":"","url":"https://api.github.com/users/phausler","html_url":"https://github.com/phausler","followers_url":"https://api.github.com/users/phausler/followers","following_url":"https://api.github.com/users/phausler/following{/other_user}","gists_url":"https://api.github.com/users/phausler/gists{/gist_id}","starred_url":"https://api.github.com/users/phausler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phausler/subscriptions","organizations_url":"https://api.github.com/users/phausler/orgs","repos_url":"https://api.github.com/users/phausler/repos","events_url":"https://api.github.com/users/phausler/events{/privacy}","received_events_url":"https://api.github.com/users/phausler/received_events","type":"User","site_admin":false},"created_at":"2017-10-19T19:33:43Z","updated_at":"2017-10-19T19:33:43Z","author_association":"MEMBER","body":"@swift-ci please smoke test"}}
{"actor":{"display_login":"phausler"}}