Python3: add patch to fix crash in asyncio

See https://bugs.python.org/issue45262

Signed-off-by: Matthias Reichl <hias@horus.com>
This commit is contained in:
Matthias Reichl 2021-10-07 15:54:44 +02:00
parent 98b3f8e247
commit 995842369b

View File

@ -0,0 +1,26 @@
From c4e2aa8d60f722cece55d446e97585b1fa8a6ae7 Mon Sep 17 00:00:00 2001
From: Matthias Reichl <hias@horus.com>
Date: Thu, 7 Oct 2021 13:03:27 +0200
Subject: [PATCH] Prevent use-after-free of running loop holder via cache
---
Modules/_asynciomodule.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index ecc73d1ca8..56079b0277 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -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);
}
--
2.30.2