{"action":"created","comment":{"url":"https://api.github.com/repos/python-pillow/Pillow/pulls/comments/215391124","pull_request_review_id":152645174,"id":215391124,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNTM5MTEyNA==","diff_hunk":"@@ -61,6 +62,28 @@ def testEnlargeCrop(self):\n         self.assert_warning(Image.DecompressionBombWarning,\n                             self.src.crop, box)\n \n+    def test_crop_decompression_checks(self):\n+\n+        im = Image.new(\"RGB\", (100, 100))\n+\n+        good_values = ((-9999, -9999, -9990, -9990),\n+                        (-999, -999, -990, -990))\n+\n+        warning_values = ((-160, -160, 99, 99),\n+                          (160, 160, -99, -99))\n+\n+        error_values = ((-99909, -99990, 99999, 99999),\n+                        (99909, 99990, -99999, -99999))\n+\n+        for value in good_values:\n+            self.assertEqual(im.crop(value).size, (9,9))\n+\n+        for value in warning_values:\n+            self.assert_warning(DecompressionBombWarning, im.crop, value)\n+\n+        for value in error_values:\n+            with self.assertRaises(DecompressionBombError):","path":"Tests/test_decompression_bomb.py","position":32,"original_position":32,"commit_id":"66207b47bca89a4fad8f4573a239b671d66b7b90","original_commit_id":"66207b47bca89a4fad8f4573a239b671d66b7b90","user":{"login":"dinkolubina","id":8204760,"node_id":"MDQ6VXNlcjgyMDQ3NjA=","avatar_url":"https://avatars2.githubusercontent.com/u/8204760?v=4","gravatar_id":"","url":"https://api.github.com/users/dinkolubina","html_url":"https://github.com/dinkolubina","followers_url":"https://api.github.com/users/dinkolubina/followers","following_url":"https://api.github.com/users/dinkolubina/following{/other_user}","gists_url":"https://api.github.com/users/dinkolubina/gists{/gist_id}","starred_url":"https://api.github.com/users/dinkolubina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinkolubina/subscriptions","organizations_url":"https://api.github.com/users/dinkolubina/orgs","repos_url":"https://api.github.com/users/dinkolubina/repos","events_url":"https://api.github.com/users/dinkolubina/events{/privacy}","received_events_url":"https://api.github.com/users/dinkolubina/received_events","type":"User","site_admin":false},"body":"Changed per instructions (moved the assertRaises in the for loop)","created_at":"2018-09-05T19:05:48Z","updated_at":"2018-09-05T19:05:48Z","html_url":"https://github.com/python-pillow/Pillow/pull/3313#discussion_r215391124","pull_request_url":"https://api.github.com/repos/python-pillow/Pillow/pulls/3313","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/python-pillow/Pillow/pulls/comments/215391124"},"html":{"href":"https://github.com/python-pillow/Pillow/pull/3313#discussion_r215391124"},"pull_request":{"href":"https://api.github.com/repos/python-pillow/Pillow/pulls/3313"}}},"pull_request":{"url":"https://api.github.com/repos/python-pillow/Pillow/pulls/3313","id":210492385,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwNDkyMzg1","html_url":"https://github.com/python-pillow/Pillow/pull/3313","diff_url":"https://github.com/python-pillow/Pillow/pull/3313.diff","patch_url":"https://github.com/python-pillow/Pillow/pull/3313.patch","issue_url":"https://api.github.com/repos/python-pillow/Pillow/issues/3313","number":3313,"state":"open","locked":false,"title":"Fix _crop and tests","user":{"login":"dinkolubina","id":8204760,"node_id":"MDQ6VXNlcjgyMDQ3NjA=","avatar_url":"https://avatars2.githubusercontent.com/u/8204760?v=4","gravatar_id":"","url":"https://api.github.com/users/dinkolubina","html_url":"https://github.com/dinkolubina","followers_url":"https://api.github.com/users/dinkolubina/followers","following_url":"https://api.github.com/users/dinkolubina/following{/other_user}","gists_url":"https://api.github.com/users/dinkolubina/gists{/gist_id}","starred_url":"https://api.github.com/users/dinkolubina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinkolubina/subscriptions","organizations_url":"https://api.github.com/users/dinkolubina/orgs","repos_url":"https://api.github.com/users/dinkolubina/repos","events_url":"https://api.github.com/users/dinkolubina/events{/privacy}","received_events_url":"https://api.github.com/users/dinkolubina/received_events","type":"User","site_admin":false},"body":"Issue being fixed:\r\nDecompressionBombWarning/Error caused by wrong values passed to it in Image._crop\r\n\r\n_bomb_decompression_check checks if the size of the image is larger than a certain value.\r\nIn Image._crop which is called from Image.crop x1 and y1 are passed to check the size of the crop.\r\nabs(x1 - x0) and abs(y1-y0) should be passed instead, since that represents the size of the crop not just x1 and y1.\r\n\r\nChanges proposed in this pull request:\r\n* Use absolute value of (x1-x0) and (y1-y0) instead of the existing check\r\n* Pas those values which represent the width and height instead just the location of x1, y1, which is not correct in the context of _decompression_bomb_check\r\n\r\n\r\nPull request is solving this issue: https://github.com/python-pillow/Pillow/issues/3312","created_at":"2018-08-23T15:41:21Z","updated_at":"2018-09-05T19:05:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"22ce960e7f75c86197cabedcd63a4dfd1c1beb7c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/python-pillow/Pillow/pulls/3313/commits","review_comments_url":"https://api.github.com/repos/python-pillow/Pillow/pulls/3313/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/3313/comments","statuses_url":"https://api.github.com/repos/python-pillow/Pillow/statuses/66207b47bca89a4fad8f4573a239b671d66b7b90","head":{"label":"dinkolubina:fix-img-crop","ref":"fix-img-crop","sha":"66207b47bca89a4fad8f4573a239b671d66b7b90","user":{"login":"dinkolubina","id":8204760,"node_id":"MDQ6VXNlcjgyMDQ3NjA=","avatar_url":"https://avatars2.githubusercontent.com/u/8204760?v=4","gravatar_id":"","url":"https://api.github.com/users/dinkolubina","html_url":"https://github.com/dinkolubina","followers_url":"https://api.github.com/users/dinkolubina/followers","following_url":"https://api.github.com/users/dinkolubina/following{/other_user}","gists_url":"https://api.github.com/users/dinkolubina/gists{/gist_id}","starred_url":"https://api.github.com/users/dinkolubina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinkolubina/subscriptions","organizations_url":"https://api.github.com/users/dinkolubina/orgs","repos_url":"https://api.github.com/users/dinkolubina/repos","events_url":"https://api.github.com/users/dinkolubina/events{/privacy}","received_events_url":"https://api.github.com/users/dinkolubina/received_events","type":"User","site_admin":false},"repo":{"id":144263551,"node_id":"MDEwOlJlcG9zaXRvcnkxNDQyNjM1NTE=","name":"Pillow","full_name":"dinkolubina/Pillow","owner":{"login":"dinkolubina","id":8204760,"node_id":"MDQ6VXNlcjgyMDQ3NjA=","avatar_url":"https://avatars2.githubusercontent.com/u/8204760?v=4","gravatar_id":"","url":"https://api.github.com/users/dinkolubina","html_url":"https://github.com/dinkolubina","followers_url":"https://api.github.com/users/dinkolubina/followers","following_url":"https://api.github.com/users/dinkolubina/following{/other_user}","gists_url":"https://api.github.com/users/dinkolubina/gists{/gist_id}","starred_url":"https://api.github.com/users/dinkolubina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dinkolubina/subscriptions","organizations_url":"https://api.github.com/users/dinkolubina/orgs","repos_url":"https://api.github.com/users/dinkolubina/repos","events_url":"https://api.github.com/users/dinkolubina/events{/privacy}","received_events_url":"https://api.github.com/users/dinkolubina/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dinkolubina/Pillow","description":"The friendly PIL fork (Python Imaging Library)","fork":true,"url":"https://api.github.com/repos/dinkolubina/Pillow","forks_url":"https://api.github.com/repos/dinkolubina/Pillow/forks","keys_url":"https://api.github.com/repos/dinkolubina/Pillow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dinkolubina/Pillow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dinkolubina/Pillow/teams","hooks_url":"https://api.github.com/repos/dinkolubina/Pillow/hooks","issue_events_url":"https://api.github.com/repos/dinkolubina/Pillow/issues/events{/number}","events_url":"https://api.github.com/repos/dinkolubina/Pillow/events","assignees_url":"https://api.github.com/repos/dinkolubina/Pillow/assignees{/user}","branches_url":"https://api.github.com/repos/dinkolubina/Pillow/branches{/branch}","tags_url":"https://api.github.com/repos/dinkolubina/Pillow/tags","blobs_url":"https://api.github.com/repos/dinkolubina/Pillow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dinkolubina/Pillow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dinkolubina/Pillow/git/refs{/sha}","trees_url":"https://api.github.com/repos/dinkolubina/Pillow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dinkolubina/Pillow/statuses/{sha}","languages_url":"https://api.github.com/repos/dinkolubina/Pillow/languages","stargazers_url":"https://api.github.com/repos/dinkolubina/Pillow/stargazers","contributors_url":"https://api.github.com/repos/dinkolubina/Pillow/contributors","subscribers_url":"https://api.github.com/repos/dinkolubina/Pillow/subscribers","subscription_url":"https://api.github.com/repos/dinkolubina/Pillow/subscription","commits_url":"https://api.github.com/repos/dinkolubina/Pillow/commits{/sha}","git_commits_url":"https://api.github.com/repos/dinkolubina/Pillow/git/commits{/sha}","comments_url":"https://api.github.com/repos/dinkolubina/Pillow/comments{/number}","issue_comment_url":"https://api.github.com/repos/dinkolubina/Pillow/issues/comments{/number}","contents_url":"https://api.github.com/repos/dinkolubina/Pillow/contents/{+path}","compare_url":"https://api.github.com/repos/dinkolubina/Pillow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dinkolubina/Pillow/merges","archive_url":"https://api.github.com/repos/dinkolubina/Pillow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dinkolubina/Pillow/downloads","issues_url":"https://api.github.com/repos/dinkolubina/Pillow/issues{/number}","pulls_url":"https://api.github.com/repos/dinkolubina/Pillow/pulls{/number}","milestones_url":"https://api.github.com/repos/dinkolubina/Pillow/milestones{/number}","notifications_url":"https://api.github.com/repos/dinkolubina/Pillow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dinkolubina/Pillow/labels{/name}","releases_url":"https://api.github.com/repos/dinkolubina/Pillow/releases{/id}","deployments_url":"https://api.github.com/repos/dinkolubina/Pillow/deployments","created_at":"2018-08-10T09:04:15Z","updated_at":"2018-08-10T09:04:19Z","pushed_at":"2018-09-05T19:00:57Z","git_url":"git://github.com/dinkolubina/Pillow.git","ssh_url":"git@github.com:dinkolubina/Pillow.git","clone_url":"https://github.com/dinkolubina/Pillow.git","svn_url":"https://github.com/dinkolubina/Pillow","homepage":"https://python-pillow.org","size":28621,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"python-pillow:master","ref":"master","sha":"fa14698e664b92498c072301718302290936e6d7","user":{"login":"python-pillow","id":2036701,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwMzY3MDE=","avatar_url":"https://avatars2.githubusercontent.com/u/2036701?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnk1MTcxNjAw","name":"Pillow","full_name":"python-pillow/Pillow","owner":{"login":"python-pillow","id":2036701,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwMzY3MDE=","avatar_url":"https://avatars2.githubusercontent.com/u/2036701?v=4","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":"2018-09-05T16:57:22Z","pushed_at":"2018-09-05T19:00:58Z","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":"https://python-pillow.org","size":28694,"stargazers_count":5267,"watchers_count":5267,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1084,"mirror_url":null,"archived":false,"open_issues_count":248,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1084,"open_issues":248,"watchers":5267,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/python-pillow/Pillow/pulls/3313"},"html":{"href":"https://github.com/python-pillow/Pillow/pull/3313"},"issue":{"href":"https://api.github.com/repos/python-pillow/Pillow/issues/3313"},"comments":{"href":"https://api.github.com/repos/python-pillow/Pillow/issues/3313/comments"},"review_comments":{"href":"https://api.github.com/repos/python-pillow/Pillow/pulls/3313/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/3313/commits"},"statuses":{"href":"https://api.github.com/repos/python-pillow/Pillow/statuses/66207b47bca89a4fad8f4573a239b671d66b7b90"}},"author_association":"NONE"}}
{"actor":{"display_login":"dinkolubina"}}