{"action":"created","comment":{"url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/comments/175792661","pull_request_review_id":105121032,"id":175792661,"diff_hunk":"@@ -2422,6 +2422,14 @@ int mbedtls_ssl_fetch_input( mbedtls_ssl_context *ssl, size_t nb_want )\n             if( ret < 0 )\n                 return( ret );\n \n+            // At this point ret value is positive, verify that adding ret \n+            // value to ssl->in_left doesn't cause a wraparound\n+            if (ssl->in_left + (size_t)ret < ssl->in_left)","path":"library/ssl_tls.c","position":6,"original_position":6,"commit_id":"5bd15cbfa09bc85b77c905ebff0bd5b57bab3888","original_commit_id":"5bd15cbfa09bc85b77c905ebff0bd5b57bab3888","user":{"login":"gilles-peskine-arm","id":26596258,"avatar_url":"https://avatars3.githubusercontent.com/u/26596258?v=4","gravatar_id":"","url":"https://api.github.com/users/gilles-peskine-arm","html_url":"https://github.com/gilles-peskine-arm","followers_url":"https://api.github.com/users/gilles-peskine-arm/followers","following_url":"https://api.github.com/users/gilles-peskine-arm/following{/other_user}","gists_url":"https://api.github.com/users/gilles-peskine-arm/gists{/gist_id}","starred_url":"https://api.github.com/users/gilles-peskine-arm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gilles-peskine-arm/subscriptions","organizations_url":"https://api.github.com/users/gilles-peskine-arm/orgs","repos_url":"https://api.github.com/users/gilles-peskine-arm/repos","events_url":"https://api.github.com/users/gilles-peskine-arm/events{/privacy}","received_events_url":"https://api.github.com/users/gilles-peskine-arm/received_events","type":"User","site_admin":false},"body":"Having read #1245, I think something analogous to the proposed check makes more sense here. If `f_recv` returned more bytes than requested, something is seriously wrong — in fact it would be a buffer overflow, so even returning an error may have left seriously corrupted data on the heap.\r\n\r\n    if( (size_t) ret > len )\r\n    {\r\n        MBEDTLS_SSL_DEBUG_MSG( 1, ( \"f_recv returned %d bytes but only %zu were requested\",\r\n                                                                   ret, len ) );\r\n        return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );\r\n    }\r\n","created_at":"2018-03-20T14:45:14Z","updated_at":"2018-03-20T14:48:04Z","html_url":"https://github.com/ARMmbed/mbedtls/pull/1395#discussion_r175792661","pull_request_url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1395","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/comments/175792661"},"html":{"href":"https://github.com/ARMmbed/mbedtls/pull/1395#discussion_r175792661"},"pull_request":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1395"}}},"pull_request":{"url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1395","id":170745743,"html_url":"https://github.com/ARMmbed/mbedtls/pull/1395","diff_url":"https://github.com/ARMmbed/mbedtls/pull/1395.diff","patch_url":"https://github.com/ARMmbed/mbedtls/pull/1395.patch","issue_url":"https://api.github.com/repos/ARMmbed/mbedtls/issues/1395","number":1395,"state":"open","locked":false,"title":"Add guard to out_left to avoid negative values","user":{"login":"mohammad1603","id":15212554,"avatar_url":"https://avatars2.githubusercontent.com/u/15212554?v=4","gravatar_id":"","url":"https://api.github.com/users/mohammad1603","html_url":"https://github.com/mohammad1603","followers_url":"https://api.github.com/users/mohammad1603/followers","following_url":"https://api.github.com/users/mohammad1603/following{/other_user}","gists_url":"https://api.github.com/users/mohammad1603/gists{/gist_id}","starred_url":"https://api.github.com/users/mohammad1603/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohammad1603/subscriptions","organizations_url":"https://api.github.com/users/mohammad1603/orgs","repos_url":"https://api.github.com/users/mohammad1603/repos","events_url":"https://api.github.com/users/mohammad1603/events{/privacy}","received_events_url":"https://api.github.com/users/mohammad1603/received_events","type":"User","site_admin":false},"body":"## Description\r\nReturn error when f_send return a value greater than out_left\r\nFixes #1245 \r\n\r\n## Status\r\n**READY**\r\n\r\n## Requires Backporting\r\n\r\nYes\r\nWhich branch?\r\nmbedtls 2.1\r\nmbedtls 2.7\r\n\r\n\r\n## Todos\r\n- [ ] Tests\r\n- [ ] Documentation\r\n- [x] Changelog updated\r\n- [x] Backported\r\n\r\n\r\n## Steps to test or reproduce\r\nOutline the steps to test or reproduce the PR here.\r\n","created_at":"2018-02-22T13:10:22Z","updated_at":"2018-03-20T14:48:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aa81a40acbf505d56b24411d60495a931b4e3589","assignee":null,"assignees":[],"requested_reviewers":[{"login":"yanesca","id":6871045,"avatar_url":"https://avatars1.githubusercontent.com/u/6871045?v=4","gravatar_id":"","url":"https://api.github.com/users/yanesca","html_url":"https://github.com/yanesca","followers_url":"https://api.github.com/users/yanesca/followers","following_url":"https://api.github.com/users/yanesca/following{/other_user}","gists_url":"https://api.github.com/users/yanesca/gists{/gist_id}","starred_url":"https://api.github.com/users/yanesca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanesca/subscriptions","organizations_url":"https://api.github.com/users/yanesca/orgs","repos_url":"https://api.github.com/users/yanesca/repos","events_url":"https://api.github.com/users/yanesca/events{/privacy}","received_events_url":"https://api.github.com/users/yanesca/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":820027428,"url":"https://api.github.com/repos/ARMmbed/mbedtls/labels/Arm%20Contribution","name":"Arm Contribution","color":"66e0ff","default":false},{"id":19280384,"url":"https://api.github.com/repos/ARMmbed/mbedtls/labels/bug","name":"bug","color":"d93f0b","default":true},{"id":705358813,"url":"https://api.github.com/repos/ARMmbed/mbedtls/labels/needs%20review","name":"needs review","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1395/commits","review_comments_url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1395/comments","review_comment_url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ARMmbed/mbedtls/issues/1395/comments","statuses_url":"https://api.github.com/repos/ARMmbed/mbedtls/statuses/5bd15cbfa09bc85b77c905ebff0bd5b57bab3888","head":{"label":"mohammad1603:iotssl-1962-f_send-length-arg-negative","ref":"iotssl-1962-f_send-length-arg-negative","sha":"5bd15cbfa09bc85b77c905ebff0bd5b57bab3888","user":{"login":"mohammad1603","id":15212554,"avatar_url":"https://avatars2.githubusercontent.com/u/15212554?v=4","gravatar_id":"","url":"https://api.github.com/users/mohammad1603","html_url":"https://github.com/mohammad1603","followers_url":"https://api.github.com/users/mohammad1603/followers","following_url":"https://api.github.com/users/mohammad1603/following{/other_user}","gists_url":"https://api.github.com/users/mohammad1603/gists{/gist_id}","starred_url":"https://api.github.com/users/mohammad1603/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohammad1603/subscriptions","organizations_url":"https://api.github.com/users/mohammad1603/orgs","repos_url":"https://api.github.com/users/mohammad1603/repos","events_url":"https://api.github.com/users/mohammad1603/events{/privacy}","received_events_url":"https://api.github.com/users/mohammad1603/received_events","type":"User","site_admin":false},"repo":{"id":110989076,"name":"mbedtls","full_name":"mohammad1603/mbedtls","owner":{"login":"mohammad1603","id":15212554,"avatar_url":"https://avatars2.githubusercontent.com/u/15212554?v=4","gravatar_id":"","url":"https://api.github.com/users/mohammad1603","html_url":"https://github.com/mohammad1603","followers_url":"https://api.github.com/users/mohammad1603/followers","following_url":"https://api.github.com/users/mohammad1603/following{/other_user}","gists_url":"https://api.github.com/users/mohammad1603/gists{/gist_id}","starred_url":"https://api.github.com/users/mohammad1603/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohammad1603/subscriptions","organizations_url":"https://api.github.com/users/mohammad1603/orgs","repos_url":"https://api.github.com/users/mohammad1603/repos","events_url":"https://api.github.com/users/mohammad1603/events{/privacy}","received_events_url":"https://api.github.com/users/mohammad1603/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mohammad1603/mbedtls","description":"An open source, portable, easy to use, readable and flexible SSL library","fork":true,"url":"https://api.github.com/repos/mohammad1603/mbedtls","forks_url":"https://api.github.com/repos/mohammad1603/mbedtls/forks","keys_url":"https://api.github.com/repos/mohammad1603/mbedtls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mohammad1603/mbedtls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mohammad1603/mbedtls/teams","hooks_url":"https://api.github.com/repos/mohammad1603/mbedtls/hooks","issue_events_url":"https://api.github.com/repos/mohammad1603/mbedtls/issues/events{/number}","events_url":"https://api.github.com/repos/mohammad1603/mbedtls/events","assignees_url":"https://api.github.com/repos/mohammad1603/mbedtls/assignees{/user}","branches_url":"https://api.github.com/repos/mohammad1603/mbedtls/branches{/branch}","tags_url":"https://api.github.com/repos/mohammad1603/mbedtls/tags","blobs_url":"https://api.github.com/repos/mohammad1603/mbedtls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mohammad1603/mbedtls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mohammad1603/mbedtls/git/refs{/sha}","trees_url":"https://api.github.com/repos/mohammad1603/mbedtls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mohammad1603/mbedtls/statuses/{sha}","languages_url":"https://api.github.com/repos/mohammad1603/mbedtls/languages","stargazers_url":"https://api.github.com/repos/mohammad1603/mbedtls/stargazers","contributors_url":"https://api.github.com/repos/mohammad1603/mbedtls/contributors","subscribers_url":"https://api.github.com/repos/mohammad1603/mbedtls/subscribers","subscription_url":"https://api.github.com/repos/mohammad1603/mbedtls/subscription","commits_url":"https://api.github.com/repos/mohammad1603/mbedtls/commits{/sha}","git_commits_url":"https://api.github.com/repos/mohammad1603/mbedtls/git/commits{/sha}","comments_url":"https://api.github.com/repos/mohammad1603/mbedtls/comments{/number}","issue_comment_url":"https://api.github.com/repos/mohammad1603/mbedtls/issues/comments{/number}","contents_url":"https://api.github.com/repos/mohammad1603/mbedtls/contents/{+path}","compare_url":"https://api.github.com/repos/mohammad1603/mbedtls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mohammad1603/mbedtls/merges","archive_url":"https://api.github.com/repos/mohammad1603/mbedtls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mohammad1603/mbedtls/downloads","issues_url":"https://api.github.com/repos/mohammad1603/mbedtls/issues{/number}","pulls_url":"https://api.github.com/repos/mohammad1603/mbedtls/pulls{/number}","milestones_url":"https://api.github.com/repos/mohammad1603/mbedtls/milestones{/number}","notifications_url":"https://api.github.com/repos/mohammad1603/mbedtls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mohammad1603/mbedtls/labels{/name}","releases_url":"https://api.github.com/repos/mohammad1603/mbedtls/releases{/id}","deployments_url":"https://api.github.com/repos/mohammad1603/mbedtls/deployments","created_at":"2017-11-16T15:34:25Z","updated_at":"2017-11-16T15:34:30Z","pushed_at":"2018-03-19T14:18:41Z","git_url":"git://github.com/mohammad1603/mbedtls.git","ssh_url":"git@github.com:mohammad1603/mbedtls.git","clone_url":"https://github.com/mohammad1603/mbedtls.git","svn_url":"https://github.com/mohammad1603/mbedtls","homepage":"https://tls.mbed.org","size":24444,"stargazers_count":0,"watchers_count":0,"language":"C","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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"development"}},"base":{"label":"ARMmbed:development","ref":"development","sha":"d76d8bc9a5383bed1d794846ebaf634327cb2414","user":{"login":"ARMmbed","id":8916057,"avatar_url":"https://avatars3.githubusercontent.com/u/8916057?v=4","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"repo":{"id":6687936,"name":"mbedtls","full_name":"ARMmbed/mbedtls","owner":{"login":"ARMmbed","id":8916057,"avatar_url":"https://avatars3.githubusercontent.com/u/8916057?v=4","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ARMmbed/mbedtls","description":"An open source, portable, easy to use, readable and flexible SSL library","fork":false,"url":"https://api.github.com/repos/ARMmbed/mbedtls","forks_url":"https://api.github.com/repos/ARMmbed/mbedtls/forks","keys_url":"https://api.github.com/repos/ARMmbed/mbedtls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ARMmbed/mbedtls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ARMmbed/mbedtls/teams","hooks_url":"https://api.github.com/repos/ARMmbed/mbedtls/hooks","issue_events_url":"https://api.github.com/repos/ARMmbed/mbedtls/issues/events{/number}","events_url":"https://api.github.com/repos/ARMmbed/mbedtls/events","assignees_url":"https://api.github.com/repos/ARMmbed/mbedtls/assignees{/user}","branches_url":"https://api.github.com/repos/ARMmbed/mbedtls/branches{/branch}","tags_url":"https://api.github.com/repos/ARMmbed/mbedtls/tags","blobs_url":"https://api.github.com/repos/ARMmbed/mbedtls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ARMmbed/mbedtls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ARMmbed/mbedtls/git/refs{/sha}","trees_url":"https://api.github.com/repos/ARMmbed/mbedtls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ARMmbed/mbedtls/statuses/{sha}","languages_url":"https://api.github.com/repos/ARMmbed/mbedtls/languages","stargazers_url":"https://api.github.com/repos/ARMmbed/mbedtls/stargazers","contributors_url":"https://api.github.com/repos/ARMmbed/mbedtls/contributors","subscribers_url":"https://api.github.com/repos/ARMmbed/mbedtls/subscribers","subscription_url":"https://api.github.com/repos/ARMmbed/mbedtls/subscription","commits_url":"https://api.github.com/repos/ARMmbed/mbedtls/commits{/sha}","git_commits_url":"https://api.github.com/repos/ARMmbed/mbedtls/git/commits{/sha}","comments_url":"https://api.github.com/repos/ARMmbed/mbedtls/comments{/number}","issue_comment_url":"https://api.github.com/repos/ARMmbed/mbedtls/issues/comments{/number}","contents_url":"https://api.github.com/repos/ARMmbed/mbedtls/contents/{+path}","compare_url":"https://api.github.com/repos/ARMmbed/mbedtls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ARMmbed/mbedtls/merges","archive_url":"https://api.github.com/repos/ARMmbed/mbedtls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ARMmbed/mbedtls/downloads","issues_url":"https://api.github.com/repos/ARMmbed/mbedtls/issues{/number}","pulls_url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls{/number}","milestones_url":"https://api.github.com/repos/ARMmbed/mbedtls/milestones{/number}","notifications_url":"https://api.github.com/repos/ARMmbed/mbedtls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ARMmbed/mbedtls/labels{/name}","releases_url":"https://api.github.com/repos/ARMmbed/mbedtls/releases{/id}","deployments_url":"https://api.github.com/repos/ARMmbed/mbedtls/deployments","created_at":"2012-11-14T13:13:13Z","updated_at":"2018-03-19T17:40:00Z","pushed_at":"2018-03-20T14:35:58Z","git_url":"git://github.com/ARMmbed/mbedtls.git","ssh_url":"git@github.com:ARMmbed/mbedtls.git","clone_url":"https://github.com/ARMmbed/mbedtls.git","svn_url":"https://github.com/ARMmbed/mbedtls","homepage":"https://tls.mbed.org","size":25252,"stargazers_count":1308,"watchers_count":1308,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":805,"mirror_url":null,"archived":false,"open_issues_count":435,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":805,"open_issues":435,"watchers":1308,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1395"},"html":{"href":"https://github.com/ARMmbed/mbedtls/pull/1395"},"issue":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/issues/1395"},"comments":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/issues/1395/comments"},"review_comments":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1395/comments"},"review_comment":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1395/commits"},"statuses":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/statuses/5bd15cbfa09bc85b77c905ebff0bd5b57bab3888"}},"author_association":"NONE"}}
{"actor":{"display_login":"gilles-peskine-arm"}}