bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref objects (#128) (#188)

This commit is contained in:
Xiang Zhang 2017-02-20 14:33:06 +08:00 committed by GitHub
parent 314a86bae2
commit 7c95a94c3a
2 changed files with 5 additions and 0 deletions

View file

@ -10,6 +10,9 @@ Release date: XXXX-XX-XX
Core and Builtins 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-29438: Fixed use-after-free problem in key sharing dict.
- Issue #29319: Prevent RunMainFromImporter overwriting sys.path[0]. - Issue #29319: Prevent RunMainFromImporter overwriting sys.path[0].

View file

@ -24,6 +24,8 @@ init_weakref(PyWeakReference *self, PyObject *ob, PyObject *callback)
{ {
self->hash = -1; self->hash = -1;
self->wr_object = ob; self->wr_object = ob;
self->wr_prev = NULL;
self->wr_next = NULL;
Py_XINCREF(callback); Py_XINCREF(callback);
self->wr_callback = callback; self->wr_callback = callback;
} }