Kaydet (Commit) 682124cc authored tarafından Benjamin Peterson's avatar Benjamin Peterson

prevent passing NULL to memcpy (closes #22605)

Patch by Jakub Wilk.
üst ad0c57fe
......@@ -2628,7 +2628,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
self->allocated = Py_SIZE(self);
}
}
else if (initial != NULL && array_Check(initial)) {
else if (initial != NULL && array_Check(initial) && len > 0) {
arrayobject *self = (arrayobject *)a;
arrayobject *other = (arrayobject *)initial;
memcpy(self->ob_item, other->ob_item, len * other->ob_descr->itemsize);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment