[Python-checkins] bpo-33803: Fix a crash in hamt.c (#7504)

Yury Selivanov webhook-mailer at python.org
Thu Jun 7 20:29:58 EDT 2018


https://github.com/python/cpython/commit/378c53cc3187dba57c7560ccc2557f516c8a7bc8
commit: 378c53cc3187dba57c7560ccc2557f516c8a7bc8
branch: master
author: Yury Selivanov <yury at magic.io>
committer: GitHub <noreply at github.com>
date: 2018-06-07T20:29:55-04:00
summary:

bpo-33803: Fix a crash in hamt.c (#7504)

files:
A Misc/NEWS.d/next/Core and Builtins/2018-06-07-20-18-38.bpo-33803.n-Nq6_.rst
M Python/hamt.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-06-07-20-18-38.bpo-33803.n-Nq6_.rst b/Misc/NEWS.d/next/Core and Builtins/2018-06-07-20-18-38.bpo-33803.n-Nq6_.rst
new file mode 100644
index 000000000000..9cb8457ac446
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2018-06-07-20-18-38.bpo-33803.n-Nq6_.rst	
@@ -0,0 +1,2 @@
+Fix a crash in hamt.c caused by enabling GC tracking for an object that
+hadn't all of its fields set to NULL.
diff --git a/Python/hamt.c b/Python/hamt.c
index 52171222b005..f8bce5961afc 100644
--- a/Python/hamt.c
+++ b/Python/hamt.c
@@ -2476,6 +2476,8 @@ hamt_alloc(void)
     if (o == NULL) {
         return NULL;
     }
+    o->h_count = 0;
+    o->h_root = NULL;
     o->h_weakreflist = NULL;
     PyObject_GC_Track(o);
     return o;



More information about the Python-checkins mailing list