mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
Closes release blocker #3627.
Merged revisions 65335 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk TESTED=./python -E -tt ./Lib/test/regrtest.py -uall (both debug and opt) ........ r65335 | neal.norwitz | 2008-07-31 10:17:14 -0700 (Thu, 31 Jul 2008) | 1 line Security patches from Apple: prevent int overflow when allocating memory ........
This commit is contained in:
parent
06db799a53
commit
3ce5d9207e
11 changed files with 201 additions and 26 deletions
|
@ -60,11 +60,12 @@ PyTuple_New(register Py_ssize_t size)
|
|||
Py_ssize_t nbytes = size * sizeof(PyObject *);
|
||||
/* Check for overflow */
|
||||
if (nbytes / sizeof(PyObject *) != (size_t)size ||
|
||||
(nbytes += sizeof(PyTupleObject) - sizeof(PyObject *))
|
||||
<= 0)
|
||||
(nbytes > PY_SSIZE_T_MAX - sizeof(PyTupleObject) - sizeof(PyObject *)))
|
||||
{
|
||||
return PyErr_NoMemory();
|
||||
}
|
||||
nbytes += sizeof(PyTupleObject) - sizeof(PyObject *);
|
||||
|
||||
op = PyObject_GC_NewVar(PyTupleObject, &PyTuple_Type, size);
|
||||
if (op == NULL)
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue