mirror of
https://github.com/python/cpython
synced 2026-09-29 09:50:29 +03:00
Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.
This commit is contained in:
parent
5f1cfbb5c0
commit
7898043868
19 changed files with 148 additions and 24 deletions
|
|
@ -2013,7 +2013,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())
|
||||
|
|
@ -2495,7 +2495,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
|
||||
|
|
@ -3647,7 +3647,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