Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e5a853c

Browse files
committed
use PyMem_NEW to detect overflow (closes #23362)
1 parent b779bfb commit e5a853c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Objects/unicodeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8501,7 +8501,7 @@ _PyUnicode_TranslateCharmap(PyObject *input,
85018501
/* allocate enough for a simple 1:1 translation without
85028502
replacements, if we need more, we'll resize */
85038503
osize = size;
8504-
output = PyMem_Malloc(osize * sizeof(Py_UCS4));
8504+
output = PyMem_NEW(Py_UCS4, osize);
85058505
opos = 0;
85068506
if (output == NULL) {
85078507
PyErr_NoMemory();

0 commit comments

Comments
 (0)