summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-01-19 10:26:26 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-01-19 10:26:26 (GMT)
commit441d30fac7f4037e4a79e4ada873de3b6f6e5a26 (patch)
treea406cb41f1b78476445786f408b95b1cd0bdb7a6 /Objects/fileobject.c
parentff12fae80e15ad29ae2557d23e70f6ff9365b31f (diff)
downloadcpython-441d30fac7f4037e4a79e4ada873de3b6f6e5a26.zip
cpython-441d30fac7f4037e4a79e4ada873de3b6f6e5a26.tar.gz
cpython-441d30fac7f4037e4a79e4ada873de3b6f6e5a26.tar.bz2
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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index d20f196..500883e 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 {