changeset: 95330:dbc92a254173 user: Victor Stinner date: Tue Mar 31 16:31:19 2015 +0200 files: Modules/socketmodule.c description: Issue #22117: Fix integer overflow check in socket_parse_timeout() on Windows diff -r f78b9f700d45 -r dbc92a254173 Modules/socketmodule.c --- a/Modules/socketmodule.c Tue Mar 31 16:56:49 2015 +0300 +++ b/Modules/socketmodule.c Tue Mar 31 16:31:19 2015 +0200 @@ -2197,6 +2197,9 @@ #ifdef MS_WINDOWS struct timeval tv; #endif +#ifndef HAVE_POLL + _PyTime_t ms; +#endif int overflow = 0; if (timeout_obj == Py_None) { @@ -2214,11 +2217,11 @@ } #ifdef MS_WINDOWS - overflow = (_PyTime_AsTimeval(timeout, &tv, _PyTime_ROUND_CEILING) < 0); + overflow |= (_PyTime_AsTimeval(*timeout, &tv, _PyTime_ROUND_CEILING) < 0); #endif #ifndef HAVE_POLL - timeout = _PyTime_AsMilliseconds(timeout, _PyTime_ROUND_CEILING); - overflow = (timeout > INT_MAX); + ms = _PyTime_AsMilliseconds(*timeout, _PyTime_ROUND_CEILING); + overflow |= (ms > INT_MAX); #endif if (overflow) { PyErr_SetString(PyExc_OverflowError,