{"action":"created","comment":{"url":"https://api.github.com/repos/python-pillow/Pillow/pulls/comments/67160284","id":67160284,"diff_hunk":"@@ -154,7 +163,11 @@ compare_bucket_count(const ColorBucket a, const ColorBucket b) {\n static ColorBucket\n create_sorted_color_palette(const ColorCube cube) {\n    ColorBucket buckets;\n-   buckets = malloc(sizeof(struct _ColorBucket)*cube->size);\n+   if (cube->size > LONG_MAX / sizeof(struct _ColorBucket)) {","path":"libImaging/QuantOctree.c","position":42,"original_position":42,"commit_id":"92a13d975d3282d727bfd7f8a2b2d4f940d4d9ac","original_commit_id":"92a13d975d3282d727bfd7f8a2b2d4f940d4d9ac","user":{"login":"wiredfool","id":19792,"avatar_url":"https://avatars.githubusercontent.com/u/19792?v=3","gravatar_id":"","url":"https://api.github.com/users/wiredfool","html_url":"https://github.com/wiredfool","followers_url":"https://api.github.com/users/wiredfool/followers","following_url":"https://api.github.com/users/wiredfool/following{/other_user}","gists_url":"https://api.github.com/users/wiredfool/gists{/gist_id}","starred_url":"https://api.github.com/users/wiredfool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiredfool/subscriptions","organizations_url":"https://api.github.com/users/wiredfool/orgs","repos_url":"https://api.github.com/users/wiredfool/repos","events_url":"https://api.github.com/users/wiredfool/events{/privacy}","received_events_url":"https://api.github.com/users/wiredfool/received_events","type":"User","site_admin":false},"body":"Because we're using the product in memcpy in line 172","created_at":"2016-06-15T13:25:54Z","updated_at":"2016-06-15T13:25:54Z","html_url":"https://github.com/python-pillow/Pillow/pull/1781#discussion_r67160284","pull_request_url":"https://api.github.com/repos/python-pillow/Pillow/pulls/1781","_links":{"self":{"href":"https://api.github.com/repos/python-pillow/Pillow/pulls/comments/67160284"},"html":{"href":"https://github.com/python-pillow/Pillow/pull/1781#discussion_r67160284"},"pull_request":{"href":"https://api.github.com/repos/python-pillow/Pillow/pulls/1781"}}},"pull_request":{"url":"https://api.github.com/repos/python-pillow/Pillow/pulls/1781","id":64248899,"html_url":"https://github.com/python-pillow/Pillow/pull/1781","diff_url":"https://github.com/python-pillow/Pillow/pull/1781.diff","patch_url":"https://github.com/python-pillow/Pillow/pull/1781.patch","issue_url":"https://api.github.com/repos/python-pillow/Pillow/issues/1781","number":1781,"state":"open","locked":false,"title":"Various checks on malloc","user":{"login":"wiredfool","id":19792,"avatar_url":"https://avatars.githubusercontent.com/u/19792?v=3","gravatar_id":"","url":"https://api.github.com/users/wiredfool","html_url":"https://github.com/wiredfool","followers_url":"https://api.github.com/users/wiredfool/followers","following_url":"https://api.github.com/users/wiredfool/following{/other_user}","gists_url":"https://api.github.com/users/wiredfool/gists{/gist_id}","starred_url":"https://api.github.com/users/wiredfool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiredfool/subscriptions","organizations_url":"https://api.github.com/users/wiredfool/orgs","repos_url":"https://api.github.com/users/wiredfool/repos","events_url":"https://api.github.com/users/wiredfool/events{/privacy}","received_events_url":"https://api.github.com/users/wiredfool/received_events","type":"User","site_admin":false},"body":"I'd like feedback on this. \r\n\r\ni think this is a good approach -- it follows the other changes that we've made to check for overflow on the mallocs. The biggest change is switching to calloc(n,size) instead of malloc(size) in some cases -- calloc does the multiplication, (is supposed to) check for overflow, and zeros the memory. I don't think that the zeroing is ever a bad thing, and there are some reports of the performance of calloc zeroing the memory faster than the memset that we use in a few places. \r\n\r\ni will probably rebase/squash this prior to merging. ","created_at":"2016-03-26T21:02:33Z","updated_at":"2016-06-15T13:25:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a729494f95933a0fb5a405eddd3d9220fa362cb5","assignee":null,"milestone":{"url":"https://api.github.com/repos/python-pillow/Pillow/milestones/18","html_url":"https://github.com/python-pillow/Pillow/milestones/3.3.0","labels_url":"https://api.github.com/repos/python-pillow/Pillow/milestones/18/labels","id":1645347,"number":18,"title":"3.3.0","description":"","creator":{"login":"aclark4life","id":72164,"avatar_url":"https://avatars.githubusercontent.com/u/72164?v=3","gravatar_id":"","url":"https://api.github.com/users/aclark4life","html_url":"https://github.com/aclark4life","followers_url":"https://api.github.com/users/aclark4life/followers","following_url":"https://api.github.com/users/aclark4life/following{/other_user}","gists_url":"https://api.github.com/users/aclark4life/gists{/gist_id}","starred_url":"https://api.github.com/users/aclark4life/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aclark4life/subscriptions","organizations_url":"https://api.github.com/users/aclark4life/orgs","repos_url":"https://api.github.com/users/aclark4life/repos","events_url":"https://api.github.com/users/aclark4life/events{/privacy}","received_events_url":"https://api.github.com/users/aclark4life/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":4,"state":"open","created_at":"2016-03-15T11:22:27Z","updated_at":"2016-06-11T14:27:29Z","due_on":"2016-07-01T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/python-pillow/Pillow/pulls/1781/commits","review_comments_url":"https://api.github.com/repos/python-pillow/Pillow/pulls/1781/comments","review_comment_url":"https://api.github.com/repos/python-pillow/Pillow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/python-pillow/Pillow/issues/1781/comments","statuses_url":"https://api.github.com/repos/python-pillow/Pillow/statuses/92a13d975d3282d727bfd7f8a2b2d4f940d4d9ac","head":{"label":"wiredfool:malloc_check","ref":"malloc_check","sha":"92a13d975d3282d727bfd7f8a2b2d4f940d4d9ac","user":{"login":"wiredfool","id":19792,"avatar_url":"https://avatars.githubusercontent.com/u/19792?v=3","gravatar_id":"","url":"https://api.github.com/users/wiredfool","html_url":"https://github.com/wiredfool","followers_url":"https://api.github.com/users/wiredfool/followers","following_url":"https://api.github.com/users/wiredfool/following{/other_user}","gists_url":"https://api.github.com/users/wiredfool/gists{/gist_id}","starred_url":"https://api.github.com/users/wiredfool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiredfool/subscriptions","organizations_url":"https://api.github.com/users/wiredfool/orgs","repos_url":"https://api.github.com/users/wiredfool/repos","events_url":"https://api.github.com/users/wiredfool/events{/privacy}","received_events_url":"https://api.github.com/users/wiredfool/received_events","type":"User","site_admin":false},"repo":{"id":8664379,"name":"Pillow","full_name":"wiredfool/Pillow","owner":{"login":"wiredfool","id":19792,"avatar_url":"https://avatars.githubusercontent.com/u/19792?v=3","gravatar_id":"","url":"https://api.github.com/users/wiredfool","html_url":"https://github.com/wiredfool","followers_url":"https://api.github.com/users/wiredfool/followers","following_url":"https://api.github.com/users/wiredfool/following{/other_user}","gists_url":"https://api.github.com/users/wiredfool/gists{/gist_id}","starred_url":"https://api.github.com/users/wiredfool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiredfool/subscriptions","organizations_url":"https://api.github.com/users/wiredfool/orgs","repos_url":"https://api.github.com/users/wiredfool/repos","events_url":"https://api.github.com/users/wiredfool/events{/privacy}","received_events_url":"https://api.github.com/users/wiredfool/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wiredfool/Pillow","description":"Pillow is the \"friendly\" PIL fork","fork":true,"url":"https://api.github.com/repos/wiredfool/Pillow","forks_url":"https://api.github.com/repos/wiredfool/Pillow/forks","keys_url":"https://api.github.com/repos/wiredfool/Pillow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wiredfool/Pillow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wiredfool/Pillow/teams","hooks_url":"https://api.github.com/repos/wiredfool/Pillow/hooks","issue_events_url":"https://api.github.com/repos/wiredfool/Pillow/issues/events{/number}","events_url":"https://api.github.com/repos/wiredfool/Pillow/events","assignees_url":"https://api.github.com/repos/wiredfool/Pillow/assignees{/user}","branches_url":"https://api.github.com/repos/wiredfool/Pillow/branches{/branch}","tags_url":"https://api.github.com/repos/wiredfool/Pillow/tags","blobs_url":"https://api.github.com/repos/wiredfool/Pillow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wiredfool/Pillow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wiredfool/Pillow/git/refs{/sha}","trees_url":"https://api.github.com/repos/wiredfool/Pillow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wiredfool/Pillow/statuses/{sha}","languages_url":"https://api.github.com/repos/wiredfool/Pillow/languages","stargazers_url":"https://api.github.com/repos/wiredfool/Pillow/stargazers","contributors_url":"https://api.github.com/repos/wiredfool/Pillow/contributors","subscribers_url":"https://api.github.com/repos/wiredfool/Pillow/subscribers","subscription_url":"https://api.github.com/repos/wiredfool/Pillow/subscription","commits_url":"https://api.github.com/repos/wiredfool/Pillow/commits{/sha}","git_commits_url":"https://api.github.com/repos/wiredfool/Pillow/git/commits{/sha}","comments_url":"https://api.github.com/repos/wiredfool/Pillow/comments{/number}","issue_comment_url":"https://api.github.com/repos/wiredfool/Pillow/issues/comments{/number}","contents_url":"https://api.github.com/repos/wiredfool/Pillow/contents/{+path}","compare_url":"https://api.github.com/repos/wiredfool/Pillow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wiredfool/Pillow/merges","archive_url":"https://api.github.com/repos/wiredfool/Pillow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wiredfool/Pillow/downloads","issues_url":"https://api.github.com/repos/wiredfool/Pillow/issues{/number}","pulls_url":"https://api.github.com/repos/wiredfool/Pillow/pulls{/number}","milestones_url":"https://api.github.com/repos/wiredfool/Pillow/milestones{/number}","notifications_url":"https://api.github.com/repos/wiredfool/Pillow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wiredfool/Pillow/labels{/name}","releases_url":"https://api.github.com/repos/wiredfool/Pillow/releases{/id}","deployments_url":"https://api.github.com/repos/wiredfool/Pillow/deployments","created_at":"2013-03-09T03:12:08Z","updated_at":"2015-03-30T17:10:49Z","pushed_at":"2016-06-11T14:40:28Z","git_url":"git://github.com/wiredfool/Pillow.git","ssh_url":"git@github.com:wiredfool/Pillow.git","clone_url":"https://github.com/wiredfool/Pillow.git","svn_url":"https://github.com/wiredfool/Pillow","homepage":"http://python-imaging.github.com","size":18375,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"python-pillow:master","ref":"master","sha":"ac6e86765d3d503f463667cc576137fa968851a0","user":{"login":"python-pillow","id":2036701,"avatar_url":"https://avatars.githubusercontent.com/u/2036701?v=3","gravatar_id":"","url":"https://api.github.com/users/python-pillow","html_url":"https://github.com/python-pillow","followers_url":"https://api.github.com/users/python-pillow/followers","following_url":"https://api.github.com/users/python-pillow/following{/other_user}","gists_url":"https://api.github.com/users/python-pillow/gists{/gist_id}","starred_url":"https://api.github.com/users/python-pillow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/python-pillow/subscriptions","organizations_url":"https://api.github.com/users/python-pillow/orgs","repos_url":"https://api.github.com/users/python-pillow/repos","events_url":"https://api.github.com/users/python-pillow/events{/privacy}","received_events_url":"https://api.github.com/users/python-pillow/received_events","type":"Organization","site_admin":false},"repo":{"id":5171600,"name":"Pillow","full_name":"python-pillow/Pillow","owner":{"login":"python-pillow","id":2036701,"avatar_url":"https://avatars.githubusercontent.com/u/2036701?v=3","gravatar_id":"","url":"https://api.github.com/users/python-pillow","html_url":"https://github.com/python-pillow","followers_url":"https://api.github.com/users/python-pillow/followers","following_url":"https://api.github.com/users/python-pillow/following{/other_user}","gists_url":"https://api.github.com/users/python-pillow/gists{/gist_id}","starred_url":"https://api.github.com/users/python-pillow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/python-pillow/subscriptions","organizations_url":"https://api.github.com/users/python-pillow/orgs","repos_url":"https://api.github.com/users/python-pillow/repos","events_url":"https://api.github.com/users/python-pillow/events{/privacy}","received_events_url":"https://api.github.com/users/python-pillow/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/python-pillow/Pillow","description":"The friendly PIL fork (Python Imaging Library)","fork":false,"url":"https://api.github.com/repos/python-pillow/Pillow","forks_url":"https://api.github.com/repos/python-pillow/Pillow/forks","keys_url":"https://api.github.com/repos/python-pillow/Pillow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/python-pillow/Pillow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/python-pillow/Pillow/teams","hooks_url":"https://api.github.com/repos/python-pillow/Pillow/hooks","issue_events_url":"https://api.github.com/repos/python-pillow/Pillow/issues/events{/number}","events_url":"https://api.github.com/repos/python-pillow/Pillow/events","assignees_url":"https://api.github.com/repos/python-pillow/Pillow/assignees{/user}","branches_url":"https://api.github.com/repos/python-pillow/Pillow/branches{/branch}","tags_url":"https://api.github.com/repos/python-pillow/Pillow/tags","blobs_url":"https://api.github.com/repos/python-pillow/Pillow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/python-pillow/Pillow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/python-pillow/Pillow/git/refs{/sha}","trees_url":"https://api.github.com/repos/python-pillow/Pillow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/python-pillow/Pillow/statuses/{sha}","languages_url":"https://api.github.com/repos/python-pillow/Pillow/languages","stargazers_url":"https://api.github.com/repos/python-pillow/Pillow/stargazers","contributors_url":"https://api.github.com/repos/python-pillow/Pillow/contributors","subscribers_url":"https://api.github.com/repos/python-pillow/Pillow/subscribers","subscription_url":"https://api.github.com/repos/python-pillow/Pillow/subscription","commits_url":"https://api.github.com/repos/python-pillow/Pillow/commits{/sha}","git_commits_url":"https://api.github.com/repos/python-pillow/Pillow/git/commits{/sha}","comments_url":"https://api.github.com/repos/python-pillow/Pillow/comments{/number}","issue_comment_url":"https://api.github.com/repos/python-pillow/Pillow/issues/comments{/number}","contents_url":"https://api.github.com/repos/python-pillow/Pillow/contents/{+path}","compare_url":"https://api.github.com/repos/python-pillow/Pillow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/python-pillow/Pillow/merges","archive_url":"https://api.github.com/repos/python-pillow/Pillow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/python-pillow/Pillow/downloads","issues_url":"https://api.github.com/repos/python-pillow/Pillow/issues{/number}","pulls_url":"https://api.github.com/repos/python-pillow/Pillow/pulls{/number}","milestones_url":"https://api.github.com/repos/python-pillow/Pillow/milestones{/number}","notifications_url":"https://api.github.com/repos/python-pillow/Pillow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/python-pillow/Pillow/labels{/name}","releases_url":"https://api.github.com/repos/python-pillow/Pillow/releases{/id}","deployments_url":"https://api.github.com/repos/python-pillow/Pillow/deployments","created_at":"2012-07-24T21:38:39Z","updated_at":"2016-06-15T07:58:55Z","pushed_at":"2016-06-15T10:59:46Z","git_url":"git://github.com/python-pillow/Pillow.git","ssh_url":"git@github.com:python-pillow/Pillow.git","clone_url":"https://github.com/python-pillow/Pillow.git","svn_url":"https://github.com/python-pillow/Pillow","homepage":"http://python-pillow.org","size":25038,"stargazers_count":2551,"watchers_count":2551,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":555,"mirror_url":null,"open_issues_count":171,"forks":555,"open_issues":171,"watchers":2551,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/python-pillow/Pillow/pulls/1781"},"html":{"href":"https://github.com/python-pillow/Pillow/pull/1781"},"issue":{"href":"https://api.github.com/repos/python-pillow/Pillow/issues/1781"},"comments":{"href":"https://api.github.com/repos/python-pillow/Pillow/issues/1781/comments"},"review_comments":{"href":"https://api.github.com/repos/python-pillow/Pillow/pulls/1781/comments"},"review_comment":{"href":"https://api.github.com/repos/python-pillow/Pillow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/python-pillow/Pillow/pulls/1781/commits"},"statuses":{"href":"https://api.github.com/repos/python-pillow/Pillow/statuses/92a13d975d3282d727bfd7f8a2b2d4f940d4d9ac"}}}}
{"actor":{"display_login":"wiredfool"}}