summaryrefslogtreecommitdiffstats
path: root/Modules/_testbuffer.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-16 11:28:22 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-16 11:28:22 (GMT)
commit1a1ff29659f068659dea07f1bd67b8fd4331071c (patch)
tree20705986aa369225a02980a11f0a6a66a9eed0ee /Modules/_testbuffer.c
parente1efc07a30f4c17723c707ad761bfad538982b0c (diff)
downloadcpython-1a1ff29659f068659dea07f1bd67b8fd4331071c.zip
cpython-1a1ff29659f068659dea07f1bd67b8fd4331071c.tar.gz
cpython-1a1ff29659f068659dea07f1bd67b8fd4331071c.tar.bz2
Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows. Added few missed PyErr_NoMemory().
Diffstat (limited to 'Modules/_testbuffer.c')
-rw-r--r--Modules/_testbuffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index 0c6ef16..176df7c 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -850,7 +850,7 @@ seq_as_ssize_array(PyObject *seq, Py_ssize_t len, int is_shape)
Py_ssize_t *dest;
Py_ssize_t x, i;
- dest = PyMem_Malloc(len * (sizeof *dest));
+ dest = PyMem_New(Py_ssize_t, len);
if (dest == NULL) {
PyErr_NoMemory();
return NULL;