diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-10-15 16:17:47 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-10-15 16:17:47 (GMT) |
commit | 736982d36dd513233a2b0e0c05b2eb3b514c3d97 (patch) | |
tree | d837b795b05728538d1dfc2acc81d7435bc8802a /Objects/unicodeobject.c | |
parent | 315aa404030f425a8bf7fdb5a5275c118555bc37 (diff) | |
parent | 9c422f3c3d0401aff0b2a5151181afcb508c928c (diff) | |
download | cpython-736982d36dd513233a2b0e0c05b2eb3b514c3d97.zip cpython-736982d36dd513233a2b0e0c05b2eb3b514c3d97.tar.gz cpython-736982d36dd513233a2b0e0c05b2eb3b514c3d97.tar.bz2 |
merge 3.4 (closes #22643)
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 208fe80..cc36e7a 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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); |