From: Benjamin Peterson Date: Mon, 2 Mar 2015 18:23:25 +0000 (-0500) Subject: use PyMem_NEW to detect overflow (closes #23362) X-Git-Tag: v3.5.0a2~44^2^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e5a853c390f76f8d73939138adf70604fe33ca4c;p=thirdparty%2FPython%2Fcpython.git use PyMem_NEW to detect overflow (closes #23362) --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 156316b15432..2bc34c573076 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -8501,7 +8501,7 @@ _PyUnicode_TranslateCharmap(PyObject *input, /* allocate enough for a simple 1:1 translation without replacements, if we need more, we'll resize */ osize = size; - output = PyMem_Malloc(osize * sizeof(Py_UCS4)); + output = PyMem_NEW(Py_UCS4, osize); opos = 0; if (output == NULL) { PyErr_NoMemory();