]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-151695: Fix use-after-free of the curses screen encoding (GH-151696) (GH...
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 19 Jun 2026 10:30:35 +0000 (13:30 +0300)
committerGitHub <noreply@github.com>
Fri, 19 Jun 2026 10:30:35 +0000 (10:30 +0000)
commite514b4a279b9cd301292e7454e7e79cf2cba9e38
treed15382cf3e304979b592847159f2571a13d2a7e7
parentb836d4026988374984e35f650b84f5561338ee07
[3.13] gh-151695: Fix use-after-free of the curses screen encoding (GH-151696) (GH-151706) (GH-151723)

The module-global 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)
(cherry picked from commit 7b55e9a93e67913d9086a7b31f5b911958f2bf14)

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