[Python-checkins] cpython (3.5): do not memcpy from NULL

benjamin.peterson python-checkins at python.org
Tue Sep 6 22:05:53 EDT 2016


https://hg.python.org/cpython/rev/66feda02f2a5
changeset:   103194:66feda02f2a5
branch:      3.5
parent:      103191:6c19ddd10c13
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue Sep 06 19:03:40 2016 -0700
summary:
  do not memcpy from NULL

files:
  Modules/hashtable.c |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Modules/hashtable.c b/Modules/hashtable.c
--- a/Modules/hashtable.c
+++ b/Modules/hashtable.c
@@ -327,7 +327,8 @@
     entry->key_hash = key_hash;
 
     assert(data_size == ht->data_size);
-    memcpy(_Py_HASHTABLE_ENTRY_DATA(entry), data, data_size);
+    if (data)
+        memcpy(_Py_HASHTABLE_ENTRY_DATA(entry), data, data_size);
 
     _Py_slist_prepend(&ht->buckets[index], (_Py_slist_item_t*)entry);
     ht->entries++;

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list