Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 81587:974ace29ee2d 3.2
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.
| author | Serhiy Storchaka <storchaka@gmail.com> |
|---|---|
| date | Sat, 19 Jan 2013 12:26:26 +0200 |
| parents | 6ec9e646ffc7 |
| children | 38830281d43b 8f10c9eae183 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Fri Jan 18 19:55:46 2013 +0200 +++ b/Modules/socketmodule.c Sat Jan 19 12:26:26 2013 +0200 @@ -1737,7 +1737,7 @@ 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 @@ 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 @@ int how; int res; - how = PyLong_AsLong(arg); + how = _PyLong_AsInt(arg); if (how == -1 && PyErr_Occurred()) return NULL; Py_BEGIN_ALLOW_THREADS
