mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks. This is a backport of changesets 13e2e44db99d and 525407d89277.
This commit is contained in:
parent
ff12fae80e
commit
441d30fac7
16 changed files with 129 additions and 20 deletions
|
@ -1737,7 +1737,7 @@ For IP sockets, the address info is a pair (hostaddr, port).");
|
|||
static PyObject *
|
||||
sock_setblocking(PySocketSockObject *s, PyObject *arg)
|
||||
{
|
||||
int block;
|
||||
long block;
|
||||
|
||||
block = PyLong_AsLong(arg);
|
||||
if (block == -1 && PyErr_Occurred())
|
||||
|
@ -2219,7 +2219,7 @@ sock_listen(PySocketSockObject *s, PyObject *arg)
|
|||
int backlog;
|
||||
int res;
|
||||
|
||||
backlog = PyLong_AsLong(arg);
|
||||
backlog = _PyLong_AsInt(arg);
|
||||
if (backlog == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
@ -2822,7 +2822,7 @@ sock_shutdown(PySocketSockObject *s, PyObject *arg)
|
|||
int how;
|
||||
int res;
|
||||
|
||||
how = PyLong_AsLong(arg);
|
||||
how = _PyLong_AsInt(arg);
|
||||
if (how == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue