mirror of https://github.com/python/cpython
bpo-45262, asyncio: Fix cache of the running loop holder (GH-28796)
Prevent use-after-free of running loop holder via cache.
This commit is contained in:
parent
0219017df7
commit
392a898353
|
@ -0,0 +1 @@
|
|||
Prevent use-after-free in asyncio. Make sure the cached running loop holder gets cleared on dealloc to prevent use-after-free in get_running_loop
|
|
@ -3239,6 +3239,9 @@ new_running_loop_holder(PyObject *loop)
|
|||
static void
|
||||
PyRunningLoopHolder_tp_dealloc(PyRunningLoopHolder *rl)
|
||||
{
|
||||
if (cached_running_holder == (PyObject *)rl) {
|
||||
cached_running_holder = NULL;
|
||||
}
|
||||
Py_CLEAR(rl->rl_loop);
|
||||
PyObject_Free(rl);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue