[Python-checkins] cpython (3.4): prevent passing NULL to memcpy (closes #22605)

benjamin.peterson python-checkins at python.org
Sat Oct 11 02:58:49 CEST 2014


https://hg.python.org/cpython/rev/4563fff4e099
changeset: 92945:4563fff4e099
branch: 3.4
parent: 92943:90c62e1f3658
user: Benjamin Peterson <benjamin at python.org>
date: Fri Oct 10 20:58:30 2014 -0400
summary:
 prevent passing NULL to memcpy (closes #22605)
Patch by Jakub Wilk.
files:
 Modules/arraymodule.c | 2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -2628,7 +2628,7 @@
 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);
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /