[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Failure of resizeterm() causes subsequent call with stdscr to crash
From: |
Bill Gray |
Subject: |
Re: Failure of resizeterm() causes subsequent call with stdscr to crash |
Date: |
Wed, 25 Sep 2024 10:35:24 -0400 |
User-agent: |
Mozilla Thunderbird |
On 9/25/24 08:29, Peter Bierma wrote:> This was reported downstream as a
bug in Python's curses module. See the
issue there: https://github.com/python/cpython/issues/120378
<https://github.com/python/cpython/issues/120378>
It seems that calling resizeterm() with some ridiculous resolution
(35000x1 in the CPython issue) causes stdscr to break (i.e., a crash). A
small reproducer:
#include <curses.h> // or ncurses.h
int
main(void)
{
initscr();
if (resizeterm(35000, 1) < 0) {
puts("resizeterm() failed, trying to reset");
}
wrefresh(stdscr); // Segfault!
return 0;
}
The limit appears to be 32767. 32768 (which, as a signed short,
is really -32768) fails. Similarly,
win = newwin( 32767, 0, 0, 0);
returns a non-NULL pointer. Go up by one, and win == NULL.
I can't come up with a reason why you'd have such a large window.
But then again, I also can't come up with a reason why it should fail.
-- Bill
At first I thought this was an issue with stdscr getting freed, but
manually resetting it with initscr() still causes use of stdscr to
crash. Any ideas?
Best regards,
Peter Bierma