Skip to content

Commit 682124c

Browse files
committed
prevent passing NULL to memcpy (closes python#22605)
Patch by Jakub Wilk.
1 parent ad0c57f commit 682124c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎Modules/arraymodule.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2628,7 +2628,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
26282628
self->allocated = Py_SIZE(self);
26292629
}
26302630
}
2631-
else if (initial != NULL && array_Check(initial)) {
2631+
else if (initial != NULL && array_Check(initial) && len > 0) {
26322632
arrayobject *self = (arrayobject *)a;
26332633
arrayobject *other = (arrayobject *)initial;
26342634
memcpy(self->ob_item, other->ob_item, len * other->ob_descr->itemsize);

0 commit comments

Comments
 (0)