bpo-27645, sqlite: Fix integer overflow on sleep by vstinner · Pull Request #6594 · python/cpython
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|$iOsd:backup", keywords, if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|$iOsO:backup", keywords, &pysqlite_ConnectionType, &target, &pages, &progress, &name, &sleep_secs)) { &pages, &progress, &name, &sleep_obj)) { return NULL; }
if (sleep_obj != NULL) { _PyTime_t sleep_secs; if (_PyTime_FromSecondsObject(&sleep_secs, sleep_obj, _PyTime_ROUND_TIMEOUT)) { return NULL; } _PyTime_t ms = _PyTime_AsMilliseconds(sleep_secs, _PyTime_ROUND_TIMEOUT); if (ms < INT_MIN || ms > INT_MAX) { PyErr_SetString(PyExc_OverflowError, "sleep is too large"); return NULL; } sleep_ms = (int)ms; }
if (!pysqlite_check_connection((pysqlite_Connection *)target)) { return NULL; }