merge 3.4 (closes #22643)

This commit is contained in:
Benjamin Peterson 2014-10-15 12:17:47 -04:00
commit 736982d36d
1 changed files with 2 additions and 3 deletions

View File

@ -9675,12 +9675,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))) {
if (length > PY_SSIZE_T_MAX / (3 * sizeof(Py_UCS4))) {
PyErr_SetString(PyExc_OverflowError, "string is too long");
return NULL;
}
tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * (size_t)length);
tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * length);
if (tmp == NULL)
return PyErr_NoMemory();
newlength = perform(kind, data, length, tmp, &maxchar);