summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-03-20 14:42:15 (GMT)
committerGitHub <noreply@github.com>2023-03-20 14:42:15 (GMT)
commitd149f15d637a323ac818a7fa719cad945828a04b (patch)
treeffcf34be95a34e68ba2c967ba15ee07fde190486
parent98833563e25c2b9bafce9f9dd1579f169f921ed7 (diff)
downloadcpython-d149f15d637a323ac818a7fa719cad945828a04b.zip
cpython-d149f15d637a323ac818a7fa719cad945828a04b.tar.gz
cpython-d149f15d637a323ac818a7fa719cad945828a04b.tar.bz2
[3.11] gh-101975: Fixed a potential SegFault on garbage collection (GH-102803) (GH-102807)
Authored-by: gaogaotiantian <gaogaotiantian@hotmail.com>
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2023-03-18-02-36-39.gh-issue-101975.HwMR1d.rst1
-rw-r--r--Python/ceval.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-03-18-02-36-39.gh-issue-101975.HwMR1d.rst b/Misc/NEWS.d/next/Core and Builtins/2023-03-18-02-36-39.gh-issue-101975.HwMR1d.rst
new file mode 100644
index 0000000..28c9a84
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2023-03-18-02-36-39.gh-issue-101975.HwMR1d.rst
@@ -0,0 +1 @@
+Fixed ``stacktop`` value on tracing entries to avoid corruption on garbage collection.
diff --git a/Python/ceval.c b/Python/ceval.c
index 96d215a..72f9c83 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1536,6 +1536,7 @@ eval_frame_handle_pending(PyThreadState *tstate)
_PyFrame_SetStackPointer(frame, stack_pointer); \
int err = trace_function_entry(tstate, frame); \
stack_pointer = _PyFrame_GetStackPointer(frame); \
+ frame->stacktop = -1; \
if (err) { \
goto error; \
} \