From: Xiang Zhang Date: Mon, 20 Feb 2017 04:25:16 +0000 (+0800) Subject: bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref object... X-Git-Tag: v3.7.0a1~1317 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d0e8212ed70445cc3d48b0d4ae7c9cb480004010;p=python bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref objects (#128) --- diff --git a/Misc/NEWS b/Misc/NEWS index 752ce052fb..0c2a5730e3 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.7.0 alpha 1? Core and Builtins ----------------- +- bpo-29347: Fixed possibly dereferencing undefined pointers + when creating weakref objects. + - bpo-29438: Fixed use-after-free problem in key sharing dict. - bpo-29546: Set the 'path' and 'name' attribute on ImportError for ``from ... import ...``. diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c index d12db9185d..da05950f3f 100644 --- a/Objects/weakrefobject.c +++ b/Objects/weakrefobject.c @@ -24,6 +24,8 @@ init_weakref(PyWeakReference *self, PyObject *ob, PyObject *callback) { self->hash = -1; self->wr_object = ob; + self->wr_prev = NULL; + self->wr_next = NULL; Py_XINCREF(callback); self->wr_callback = callback; }