summaryrefslogtreecommitdiffstats
path: root/Modules/_testbuffer.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-16 11:33:32 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-16 11:33:32 (GMT)
commit4d0d9829851915e97ae392dd803976be6c95c8d1 (patch)
treee93666c54592b95dbca422ec66d0896f827957b3 /Modules/_testbuffer.c
parent53fa8b2a4bbb589d3d761284c70f93e0f852df23 (diff)
parent1a1ff29659f068659dea07f1bd67b8fd4331071c (diff)
downloadcpython-4d0d9829851915e97ae392dd803976be6c95c8d1.zip
cpython-4d0d9829851915e97ae392dd803976be6c95c8d1.tar.gz
cpython-4d0d9829851915e97ae392dd803976be6c95c8d1.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 a563a04..de7b567 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;