[issue22605] memcpy(NULL, NULL, 0) in array_new()

Jakub Wilk report at bugs.python.org
Fri Oct 10 21:18:23 CEST 2014


New submission from Jakub Wilk:

If you initialize array with another empty array, then this code runs:

    memcpy(self->ob_item, other->ob_item, len * other->ob_descr->itemsize);

But self->ob_item and other->ob_item are NULL in such case.
Passing null pointer to memcpy() is undefined behavior even when length is 0.

----------
title: memcpy(NULL, NULL, 0) in -> memcpy(NULL, NULL, 0) in array_new()

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22605>
_______________________________________


More information about the Python-bugs-list mailing list