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` (pythonGH-126733)

(cherry picked from commit 37c57df)

Co-authored-by: Kumar Aditya <[email protected]>
  • Loading branch information
kumaraditya303 authored and miss-islington committed Nov 12, 2024
1 parent 4f1440f commit c70d59c
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 @@ -994,8 +994,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 c70d59c

Please sign in to comment.