diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-19 10:55:39 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-19 10:55:39 (GMT) |
| commit | 74f49ab28b91d3c23524356230feb2724ee9b23f (patch) | |
| tree | 0ddd5e8899d06c974dfc25a7dfc298e3f6f70039 /Objects/fileobject.c | |
| parent | ac7b49f4076a4336915d13a4aa19feaeadd29d62 (diff) | |
| download | cpython-74f49ab28b91d3c23524356230feb2724ee9b23f.zip cpython-74f49ab28b91d3c23524356230feb2724ee9b23f.tar.gz cpython-74f49ab28b91d3c23524356230feb2724ee9b23f.tar.bz2 | |
Issue #15989: Fix several occurrences of integer overflow
when result of PyInt_AsLong() or PyLong_AsLong() narrowed
to int without checks.
This is a backport of changesets 13e2e44db99d and 525407d89277.
Diffstat (limited to 'Objects/fileobject.c')
| -rw-r--r-- | Objects/fileobject.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index ece2370..76cdf74 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -2659,10 +2659,10 @@ int PyObject_AsFileDescriptor(PyObject *o) PyObject *meth; if (PyInt_Check(o)) { - fd = PyInt_AsLong(o); + fd = _PyInt_AsInt(o); } else if (PyLong_Check(o)) { - fd = PyLong_AsLong(o); + fd = _PyLong_AsInt(o); } else if ((meth = PyObject_GetAttrString(o, "fileno")) != NULL) { @@ -2672,11 +2672,11 @@ int PyObject_AsFileDescriptor(PyObject *o) return -1; if (PyInt_Check(fno)) { - fd = PyInt_AsLong(fno); + fd = _PyInt_AsInt(fno); Py_DECREF(fno); } else if (PyLong_Check(fno)) { - fd = PyLong_AsLong(fno); + fd = _PyLong_AsInt(fno); Py_DECREF(fno); } else { |
