summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2018-06-08 00:29:55 (GMT)
committerGitHub <noreply@github.com>2018-06-08 00:29:55 (GMT)
commit378c53cc3187dba57c7560ccc2557f516c8a7bc8 (patch)
treea4676068fa48188ca869a0a8e6be80737ce742e6
parentc4f3cb772bc2d93d91ee1750eed817262f3ed57d (diff)
downloadcpython-378c53cc3187dba57c7560ccc2557f516c8a7bc8.zip
cpython-378c53cc3187dba57c7560ccc2557f516c8a7bc8.tar.gz
cpython-378c53cc3187dba57c7560ccc2557f516c8a7bc8.tar.bz2
bpo-33803: Fix a crash in hamt.c (#7504)
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2018-06-07-20-18-38.bpo-33803.n-Nq6_.rst2
-rw-r--r--Python/hamt.c2
2 files changed, 4 insertions, 0 deletions
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 0000000..9cb8457
--- /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 5217122..f8bce59 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;