From 995842369b5037237bc8377c91d3074de2813b40 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Thu, 7 Oct 2021 15:54:44 +0200 Subject: [PATCH] Python3: add patch to fix crash in asyncio See https://bugs.python.org/issue45262 Signed-off-by: Matthias Reichl --- .../patches/Python3-0500-fix-bpo45262.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 packages/lang/Python3/patches/Python3-0500-fix-bpo45262.patch diff --git a/packages/lang/Python3/patches/Python3-0500-fix-bpo45262.patch b/packages/lang/Python3/patches/Python3-0500-fix-bpo45262.patch new file mode 100644 index 0000000000..b1e671e1c8 --- /dev/null +++ b/packages/lang/Python3/patches/Python3-0500-fix-bpo45262.patch @@ -0,0 +1,26 @@ +From c4e2aa8d60f722cece55d446e97585b1fa8a6ae7 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +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 +