summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgaogaotiantian <gaogaotiantian@hotmail.com>2023-03-18 10:59:21 (GMT)
committerGitHub <noreply@github.com>2023-03-18 10:59:21 (GMT)
commit039714d00f147be4d018fa6aeaf174aad7e8fa32 (patch)
treec936a730292a522cd6ad1a834dfb74b7dcb45855
parentb3cc11a08e1e9121ddba3b9afb9fae032e86f449 (diff)
downloadcpython-039714d00f147be4d018fa6aeaf174aad7e8fa32.zip
cpython-039714d00f147be4d018fa6aeaf174aad7e8fa32.tar.gz
cpython-039714d00f147be4d018fa6aeaf174aad7e8fa32.tar.bz2
gh-101975: Fixed a potential SegFault on garbage collection (GH-102803)
-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_macros.h1
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_macros.h b/Python/ceval_macros.h
index 98b72ec..c225751 100644
--- a/Python/ceval_macros.h
+++ b/Python/ceval_macros.h
@@ -310,6 +310,7 @@ GETITEM(PyObject *v, Py_ssize_t i) {
_PyFrame_SetStackPointer(frame, stack_pointer); \
int err = trace_function_entry(tstate, frame); \
stack_pointer = _PyFrame_GetStackPointer(frame); \
+ frame->stacktop = -1; \
if (err) { \
goto error; \
} \