]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-101975: Fixed a potential SegFault on garbage collection (GH-102803)
authorgaogaotiantian <gaogaotiantian@hotmail.com>
Sat, 18 Mar 2023 10:59:21 +0000 (03:59 -0700)
committerGitHub <noreply@github.com>
Sat, 18 Mar 2023 10:59:21 +0000 (10:59 +0000)
Misc/NEWS.d/next/Core and Builtins/2023-03-18-02-36-39.gh-issue-101975.HwMR1d.rst [new file with mode: 0644]
Python/ceval_macros.h

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 (file)
index 0000000..28c9a84
--- /dev/null
@@ -0,0 +1 @@
+Fixed ``stacktop`` value on tracing entries to avoid corruption on garbage collection.
index 98b72ec1b364285d86a2d3ce9329b1d2b8033680..c2257515a305994de8a8016d3f1b5761253694c1 100644 (file)
@@ -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; \
         } \