]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-140815: Fix faulthandler for invalid/freed frame (GH-140921) (#140981)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 4 Nov 2025 11:18:23 +0000 (12:18 +0100)
committerGitHub <noreply@github.com>
Tue, 4 Nov 2025 11:18:23 +0000 (11:18 +0000)
commit331b4b868c1056370f150a6426bea9e1e5c52aff
treec989ffb2a4a142e438b7ce3a316791eb489d3887
parenta9c964f3686adaee27c23eaadd79cfd8ffb287f5
[3.14] gh-140815: Fix faulthandler for invalid/freed frame (GH-140921) (#140981)

gh-140815: Fix faulthandler for invalid/freed frame (GH-140921)

faulthandler now detects if a frame or a code object is invalid or
freed.

Add helper functions:

* _PyCode_SafeAddr2Line()
* _PyFrame_SafeGetCode()
* _PyFrame_SafeGetLasti()

_PyMem_IsPtrFreed() now detects pointers in [-0xff, 0xff] range
as freed.
(cherry picked from commit a84181c31bfc45a1d6bcb1296bd298ad612c54d0)

Co-authored-by: Victor Stinner <vstinner@python.org>
Include/internal/pycore_code.h
Include/internal/pycore_interpframe.h
Include/internal/pycore_pymem.h
Misc/NEWS.d/next/Library/2025-11-02-19-23-32.gh-issue-140815.McEG-T.rst [new file with mode: 0644]
Objects/codeobject.c
Python/traceback.c