mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
gh-120378: Fix crash caused by integer overflow in curses (#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. Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
7bd9dbf8e1
commit
c2ba931318
4 changed files with 105 additions and 27 deletions
|
|
@ -1081,6 +1081,14 @@ class TestCurses(unittest.TestCase):
|
|||
self.assertEqual(curses.LINES, lines)
|
||||
self.assertEqual(curses.COLS, cols)
|
||||
|
||||
with self.assertRaises(OverflowError):
|
||||
curses.resize_term(35000, 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
curses.resize_term(1, 35000)
|
||||
# GH-120378: Overflow failure in resize_term() causes refresh to fail
|
||||
tmp = curses.initscr()
|
||||
tmp.erase()
|
||||
|
||||
@requires_curses_func('resizeterm')
|
||||
def test_resizeterm(self):
|
||||
curses.update_lines_cols()
|
||||
|
|
@ -1095,6 +1103,14 @@ class TestCurses(unittest.TestCase):
|
|||
self.assertEqual(curses.LINES, lines)
|
||||
self.assertEqual(curses.COLS, cols)
|
||||
|
||||
with self.assertRaises(OverflowError):
|
||||
curses.resizeterm(35000, 1)
|
||||
with self.assertRaises(OverflowError):
|
||||
curses.resizeterm(1, 35000)
|
||||
# GH-120378: Overflow failure in resizeterm() causes refresh to fail
|
||||
tmp = curses.initscr()
|
||||
tmp.erase()
|
||||
|
||||
def test_ungetch(self):
|
||||
curses.ungetch(b'A')
|
||||
self.assertEqual(self.stdscr.getkey(), 'A')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue