]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-152275: Add integer overflow guards to the curses chtype and color-pair packing...
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 27 Jun 2026 12:42:41 +0000 (15:42 +0300)
committerGitHub <noreply@github.com>
Sat, 27 Jun 2026 12:42:41 +0000 (15:42 +0300)
commit7bf63facfd0ab15490f44ebfb03d010d73da1c4f
treebe73a5e19757fec64313274eaa9767e57d46aa1a
parent3fa72d5c2e8188b5aca45e0c50349f9bdfda245f
gh-152275: Add integer overflow guards to the curses chtype and color-pair packing path (GH-152303)

curses.color_pair() now raises OverflowError for a pair number too large
to be packed, instead of silently masking it to a different pair.

The attr argument of the character-cell and attribute methods (addch,
addstr, attron, attrset and others) now goes through the checked attr
converter, so an out-of-range or non-integer attribute is rejected rather
than silently truncated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Doc/library/curses.rst
Lib/test/test_curses.py
Misc/NEWS.d/next/Library/2026-06-26-17-18-01.gh-issue-152275.V64zKa.rst [new file with mode: 0644]
Modules/_cursesmodule.c
Modules/clinic/_cursesmodule.c.h