mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +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
|
@ -1318,7 +1318,10 @@ PyObject *
|
|||
_PyObject_GC_Malloc(size_t basicsize)
|
||||
{
|
||||
PyObject *op;
|
||||
PyGC_Head *g = (PyGC_Head *)PyObject_MALLOC(
|
||||
PyGC_Head *g;
|
||||
if (basicsize > PY_SSIZE_T_MAX - sizeof(PyGC_Head))
|
||||
return PyErr_NoMemory();
|
||||
g = (PyGC_Head *)PyObject_MALLOC(
|
||||
sizeof(PyGC_Head) + basicsize);
|
||||
if (g == NULL)
|
||||
return PyErr_NoMemory();
|
||||
|
@ -1361,6 +1364,8 @@ _PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems)
|
|||
{
|
||||
const size_t basicsize = _PyObject_VAR_SIZE(Py_TYPE(op), nitems);
|
||||
PyGC_Head *g = AS_GC(op);
|
||||
if (basicsize > PY_SSIZE_T_MAX - sizeof(PyGC_Head))
|
||||
return (PyVarObject *)PyErr_NoMemory();
|
||||
g = (PyGC_Head *)PyObject_REALLOC(g, sizeof(PyGC_Head) + basicsize);
|
||||
if (g == NULL)
|
||||
return (PyVarObject *)PyErr_NoMemory();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue