]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.15] gh-151695: Fix use-after-free of the curses screen encoding (GH-151696) (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 19 Jun 2026 09:07:51 +0000 (11:07 +0200)
committerGitHub <noreply@github.com>
Fri, 19 Jun 2026 09:07:51 +0000 (09:07 +0000)
commit022a018b5b85d98050610e80dc5b784ea26574e5
treecb8f57b18f01209b72f127a028d53e7ed6bf2b0b
parent7e368380f899c0b83b3b4b383371481021d9aabe
[3.15] gh-151695: Fix use-after-free of the curses screen encoding (GH-151696) (GH-151703)

The module-global curses_screen_encoding stored a borrowed pointer to the
encoding owned by the window returned by the first initscr() call.  That
window can be deallocated while unctrl() and ungetch(), which have no window
of their own, still use the pointer to encode non-ASCII characters.

Keep a private copy of the encoding instead.
(cherry picked from commit 551f8e16f8bb38a1e9c6df259a2a0969493de070)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Misc/NEWS.d/next/Library/2026-06-19-07-26-20.gh-issue-151695.IBDlkN.rst [new file with mode: 0644]
Modules/_cursesmodule.c