diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-10-15 16:17:33 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-10-15 16:17:33 (GMT) |
commit | 9c422f3c3d0401aff0b2a5151181afcb508c928c (patch) | |
tree | 48db803392eb475c35a3885f6a670f9e09946913 | |
parent | 60d7a731940d978cc152181507522f6b90240f97 (diff) | |
parent | 1e211ff10dbab6da8fc7170bd09cd6fdaeec9dde (diff) | |
download | cpython-9c422f3c3d0401aff0b2a5151181afcb508c928c.zip cpython-9c422f3c3d0401aff0b2a5151181afcb508c928c.tar.gz cpython-9c422f3c3d0401aff0b2a5151181afcb508c928c.tar.bz2 |
merge 3.3
-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 87df740..b8605a7 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9651,12 +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))) { + 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); |