Skip to content

Commit 7c95a94

Browse files
authored
bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref objects (#128) (#188)
1 parent 314a86b commit 7c95a94

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Misc/NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Release date: XXXX-XX-XX
1010
Core and Builtins
1111
-----------------
1212

13+
- bpo-29347: Fixed possibly dereferencing undefined pointers
14+
when creating weakref objects.
15+
1316
- bpo-29438: Fixed use-after-free problem in key sharing dict.
1417

1518
- Issue #29319: Prevent RunMainFromImporter overwriting sys.path[0].

Objects/weakrefobject.c

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ init_weakref(PyWeakReference *self, PyObject *ob, PyObject *callback)
2424
{
2525
self->hash = -1;
2626
self->wr_object = ob;
27+
self->wr_prev = NULL;
28+
self->wr_next = NULL;
2729
Py_XINCREF(callback);
2830
self->wr_callback = callback;
2931
}

0 commit comments

Comments
 (0)