[Python-checkins] cpython (3.3): make sure length is unsigned

benjamin.peterson python-checkins at python.org
Wed Oct 15 17:51:53 CEST 2014


https://hg.python.org/cpython/rev/6a91e616485a
changeset:   93071:6a91e616485a
branch:      3.3
parent:      93068:449b1f427cc7
user:        Benjamin Peterson <benjamin at python.org>
date:        Wed Oct 15 11:51:05 2014 -0400
summary:
  make sure length is unsigned

files:
  Objects/unicodeobject.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -9489,7 +9489,7 @@
         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);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list