mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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.
This commit is contained in:
commit
9101e23ff6
19 changed files with 151 additions and 25 deletions
|
@ -200,7 +200,7 @@ PyObject_AsFileDescriptor(PyObject *o)
|
|||
_Py_IDENTIFIER(fileno);
|
||||
|
||||
if (PyLong_Check(o)) {
|
||||
fd = PyLong_AsLong(o);
|
||||
fd = _PyLong_AsInt(o);
|
||||
}
|
||||
else if ((meth = _PyObject_GetAttrId(o, &PyId_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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue