Skip to content

Commit

Permalink
pythongh-126405: fix use-after-free in `_asyncio.Future.remove_done_c…
Browse files Browse the repository at this point in the history
…allback` (python#126733)
  • Loading branch information
kumaraditya303 authored Nov 12, 2024
1 parent 0ef84b0 commit 37c57df
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,8 +1017,10 @@ _asyncio_Future_remove_done_callback_impl(FutureObj *self, PyTypeObject *cls,

if (len == 1) {
PyObject *cb_tup = PyList_GET_ITEM(self->fut_callbacks, 0);
Py_INCREF(cb_tup);
int cmp = PyObject_RichCompareBool(
PyTuple_GET_ITEM(cb_tup, 0), fn, Py_EQ);
Py_DECREF(cb_tup);
if (cmp == -1) {
return NULL;
}
Expand Down

0 comments on commit 37c57df

Please sign in to comment.