mirror of
https://github.com/python/cpython.git
synced 2025-08-29 05:05:03 +00:00
merge 3.3 (#22643)
This commit is contained in:
commit
1cbb3fe775
3 changed files with 13 additions and 0 deletions
|
@ -9651,6 +9651,11 @@ case_operation(PyObject *self,
|
|||
kind = PyUnicode_KIND(self);
|
||||
data = PyUnicode_DATA(self);
|
||||
length = PyUnicode_GET_LENGTH(self);
|
||||
if (length > PY_SSIZE_T_MAX / 3 ||
|
||||
length > PY_SIZE_MAX / (3 * sizeof(Py_UCS4))) {
|
||||
PyErr_SetString(PyExc_OverflowError, "string is too long");
|
||||
return NULL;
|
||||
}
|
||||
tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * length);
|
||||
if (tmp == NULL)
|
||||
return PyErr_NoMemory();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue