diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-19 12:26:26 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-19 12:26:26 +0200 |
commit | 47b7a0515b94d83b8eb07548116e10ec971282b7 (patch) | |
tree | 523ee130d55a69d7d208e40fbb56c2e5d11eeb36 /Objects/fileobject.c | |
parent | dd97b3243aab31dd2c7bb9ca910207a94690c774 (diff) | |
download | cpython-47b7a0515b94d83b8eb07548116e10ec971282b7.tar.gz |
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.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r-- | Objects/fileobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index d20f196b27..500883edf6 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -200,7 +200,7 @@ PyObject_AsFileDescriptor(PyObject *o) PyObject *meth; if (PyLong_Check(o)) { - fd = PyLong_AsLong(o); + fd = _PyLong_AsInt(o); } else if ((meth = PyObject_GetAttrString(o, "fileno")) != NULL) { @@ -210,7 +210,7 @@ PyObject_AsFileDescriptor(PyObject *o) return -1; if (PyLong_Check(fno)) { - fd = PyLong_AsLong(fno); + fd = _PyLong_AsInt(fno); Py_DECREF(fno); } else { |