Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 736982d

Browse files
committed
merge 3.4 (closes #22643)
2 parents 315aa40 + 9c422f3 commit 736982d

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Objects/unicodeobject.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9675,12 +9675,11 @@ case_operation(PyObject *self,
96759675
kind = PyUnicode_KIND(self);
96769676
data = PyUnicode_DATA(self);
96779677
length = PyUnicode_GET_LENGTH(self);
9678-
if (length > PY_SSIZE_T_MAX / 3 ||
9679-
length > PY_SIZE_MAX / (3 * sizeof(Py_UCS4))) {
9678+
if (length > PY_SSIZE_T_MAX / (3 * sizeof(Py_UCS4))) {
96809679
PyErr_SetString(PyExc_OverflowError, "string is too long");
96819680
return NULL;
96829681
}
9683-
tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * (size_t)length);
9682+
tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * length);
96849683
if (tmp == NULL)
96859684
return PyErr_NoMemory();
96869685
newlength = perform(kind, data, length, tmp, &maxchar);

0 commit comments

Comments
 (0)