{"action":"created","issue":{"url":"https://api.github.com/repos/curl/curl/issues/646","repository_url":"https://api.github.com/repos/curl/curl","labels_url":"https://api.github.com/repos/curl/curl/issues/646/labels{/name}","comments_url":"https://api.github.com/repos/curl/curl/issues/646/comments","events_url":"https://api.github.com/repos/curl/curl/issues/646/events","html_url":"https://github.com/curl/curl/pull/646","id":133033233,"number":646,"title":"Fix potential overflow problem with timevals ","user":{"login":"Andersbakken","id":73034,"avatar_url":"https://avatars.githubusercontent.com/u/73034?v=3","gravatar_id":"","url":"https://api.github.com/users/Andersbakken","html_url":"https://github.com/Andersbakken","followers_url":"https://api.github.com/users/Andersbakken/followers","following_url":"https://api.github.com/users/Andersbakken/following{/other_user}","gists_url":"https://api.github.com/users/Andersbakken/gists{/gist_id}","starred_url":"https://api.github.com/users/Andersbakken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Andersbakken/subscriptions","organizations_url":"https://api.github.com/users/Andersbakken/orgs","repos_url":"https://api.github.com/users/Andersbakken/repos","events_url":"https://api.github.com/users/Andersbakken/events{/privacy}","received_events_url":"https://api.github.com/users/Andersbakken/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"bagder","id":177011,"avatar_url":"https://avatars.githubusercontent.com/u/177011?v=3","gravatar_id":"","url":"https://api.github.com/users/bagder","html_url":"https://github.com/bagder","followers_url":"https://api.github.com/users/bagder/followers","following_url":"https://api.github.com/users/bagder/following{/other_user}","gists_url":"https://api.github.com/users/bagder/gists{/gist_id}","starred_url":"https://api.github.com/users/bagder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagder/subscriptions","organizations_url":"https://api.github.com/users/bagder/orgs","repos_url":"https://api.github.com/users/bagder/repos","events_url":"https://api.github.com/users/bagder/events{/privacy}","received_events_url":"https://api.github.com/users/bagder/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-02-11T17:17:21Z","updated_at":"2016-02-12T02:08:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/curl/curl/pulls/646","html_url":"https://github.com/curl/curl/pull/646","diff_url":"https://github.com/curl/curl/pull/646.diff","patch_url":"https://github.com/curl/curl/pull/646.patch"},"body":"When comparing a null timeval with a current timeval using curlx_tvdiff on a 32-bit linux system there's an overflow happening. \r\n\r\nCompiling with -fsanitize=undefined I get this warning on startup of our app using libcurl:\r\n\r\n.../curl/lib/timeval.c:120:37: runtime error: signed integer overflow: 5873565 * 1000 cannot be represented in type 'long int'\r\n\r\nThe attached fix solves the problem by checking for a null timeval before comparing. Strictly speaking the function probably should return something that's guaranteed to be 64-bit but the majority of the usecases actually cast the result to an int and basically just compares two timevals that are close together so I decided against making a bigger change."},"comment":{"url":"https://api.github.com/repos/curl/curl/issues/comments/183149655","html_url":"https://github.com/curl/curl/pull/646#issuecomment-183149655","issue_url":"https://api.github.com/repos/curl/curl/issues/646","id":183149655,"user":{"login":"Andersbakken","id":73034,"avatar_url":"https://avatars.githubusercontent.com/u/73034?v=3","gravatar_id":"","url":"https://api.github.com/users/Andersbakken","html_url":"https://github.com/Andersbakken","followers_url":"https://api.github.com/users/Andersbakken/followers","following_url":"https://api.github.com/users/Andersbakken/following{/other_user}","gists_url":"https://api.github.com/users/Andersbakken/gists{/gist_id}","starred_url":"https://api.github.com/users/Andersbakken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Andersbakken/subscriptions","organizations_url":"https://api.github.com/users/Andersbakken/orgs","repos_url":"https://api.github.com/users/Andersbakken/repos","events_url":"https://api.github.com/users/Andersbakken/events{/privacy}","received_events_url":"https://api.github.com/users/Andersbakken/received_events","type":"User","site_admin":false},"created_at":"2016-02-12T02:08:23Z","updated_at":"2016-02-12T02:08:23Z","body":"Yeah. That might be a better fix actually. "}}