[3.13] gh-120378: Fix crash caused by integer overflow in curses (GH-124555) (#124905)

gh-120378: Fix crash caused by integer overflow in `curses` (GH-124555)

This is actually an upstream problem in curses, and has been reported
to them already:
https://lists.gnu.org/archive/html/bug-ncurses/2024-09/msg00101.html

This is a nice workaround in the meantime to prevent the segfault.

(cherry picked from commit c2ba931318)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2024-10-07 23:46:57 +02:00 committed by GitHub
parent f5f1d45f17
commit 2d3087b3cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 105 additions and 27 deletions

View file

@ -4071,9 +4071,9 @@ NoArgNoReturnFunctionBody(resetty)
/*[clinic input]
_curses.resizeterm
nlines: int
nlines: short
Height.
ncols: int
ncols: short
Width.
/
@ -4084,8 +4084,8 @@ window dimensions (in particular the SIGWINCH handler).
[clinic start generated code]*/
static PyObject *
_curses_resizeterm_impl(PyObject *module, int nlines, int ncols)
/*[clinic end generated code: output=56d6bcc5194ad055 input=0fca02ebad5ffa82]*/
_curses_resizeterm_impl(PyObject *module, short nlines, short ncols)
/*[clinic end generated code: output=4de3abab50c67f02 input=414e92a63e3e9899]*/
{
PyObject *result;
@ -4107,9 +4107,9 @@ _curses_resizeterm_impl(PyObject *module, int nlines, int ncols)
/*[clinic input]
_curses.resize_term
nlines: int
nlines: short
Height.
ncols: int
ncols: short
Width.
/
@ -4123,8 +4123,8 @@ without additional interaction with the application.
[clinic start generated code]*/
static PyObject *
_curses_resize_term_impl(PyObject *module, int nlines, int ncols)
/*[clinic end generated code: output=9e26d8b9ea311ed2 input=2197edd05b049ed4]*/
_curses_resize_term_impl(PyObject *module, short nlines, short ncols)
/*[clinic end generated code: output=46c6d749fa291dbd input=276afa43d8ea7091]*/
{
PyObject *result;