mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Security patches from Apple: prevent int overflow when allocating memory
This commit is contained in:
parent
e70f8e1205
commit
e7d8be80ba
13 changed files with 258 additions and 29 deletions
|
@ -431,6 +431,10 @@ buffer_repeat(PyBufferObject *self, Py_ssize_t count)
|
|||
count = 0;
|
||||
if (!get_buf(self, &ptr, &size, ANY_BUFFER))
|
||||
return NULL;
|
||||
if (count > PY_SSIZE_T_MAX / size) {
|
||||
PyErr_SetString(PyExc_MemoryError, "result too large");
|
||||
return NULL;
|
||||
}
|
||||
ob = PyString_FromStringAndSize(NULL, size * count);
|
||||
if ( ob == NULL )
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue