8000 Merge pull request #19007 from cgohlke/patch-1 · constanzafierro/numpy@c33992f · GitHub
[go: up one dir, main page]

Skip to content

Commit c33992f

Browse files
authored
Merge pull request numpy#19007 from cgohlke/patch-1
BUG: fix potential use of null pointer in nditer buffers
2 parents fb4ea91 + 853dba4 commit c33992f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

numpy/core/src/multiarray/nditer_constr.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,10 @@ NpyIter_Copy(NpyIter *iter)
594594
if (buffers[iop] == NULL) {
595595
out_of_memory = 1;
596596
}
597-
if (PyDataType_FLAGCHK(dtypes[iop], NPY_NEEDS_INIT)) {
598-
memset(buffers[iop], '\0', itemsize*buffersize);
597+
else {
598+
if (PyDataType_FLAGCHK(dtypes[iop], NPY_NEEDS_INIT)) {
599+
memset(buffers[iop], '\0', itemsize*buffersize);
600+
}
599601
}
600602
}
601603
}

0 commit comments

Comments
 (0)
0