commit | 441d30fac7f4037e4a79e4ada873de3b6f6e5a26 | [log] [tgz] |
---|---|---|
author | Serhiy Storchaka <storchaka@gmail.com> | Sat Jan 19 12:26:26 2013 +0200 |
committer | Serhiy Storchaka <storchaka@gmail.com> | Sat Jan 19 12:26:26 2013 +0200 |
tree | a406cb41f1b78476445786f408b95b1cd0bdb7a6 | |
parent | ff12fae80e15ad29ae2557d23e70f6ff9365b31f [diff] [blame] |
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.
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c index 8ea7c58..ad4a7e6 100644 --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c
@@ -240,7 +240,7 @@ return -1; } - fd = PyLong_AsLong(nameobj); + fd = _PyLong_AsInt(nameobj); if (fd < 0) { if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ValueError,