]> granicus.if.org Git - python/commitdiff
make sure length is unsigned
authorBenjamin Peterson <benjamin@python.org>
Wed, 15 Oct 2014 15:51:05 +0000 (11:51 -0400)
committerBenjamin Peterson <benjamin@python.org>
Wed, 15 Oct 2014 15:51:05 +0000 (11:51 -0400)
Objects/unicodeobject.c

index 35da4575308d01d70f8f66e8a28bbb5a91777f91..2a10eec5ebc127a852440078d24094e0ecd654a7 100644 (file)
@@ -9489,7 +9489,7 @@ case_operation(PyObject *self,
         PyErr_SetString(PyExc_OverflowError, "string is too long");
         return NULL;
     }
-    tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * length);
+    tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * (size_t)length);
     if (tmp == NULL)
         return PyErr_NoMemory();
     newlength = perform(kind, data, length, tmp, &maxchar);