bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ncurses can crash when resizing one of several screens


From: Scott Dolim
Subject: Ncurses can crash when resizing one of several screens
Date: Sat, 3 Jul 2010 01:05:29 -0700

Hello,

I'm using ncurses in a possibly unusual way: I create several SCREENs
on a set of tty's which are communicating with separate telnet
sessions via sockets on their pty sides.  Therefore, they get a
SIGWINCH when the telnet client's window (xterm) is resized.

The problem I'm finding is that when one of the SCREENs is resized,
then a subsequent doupdate() on a separate SCREEN can segfault.  It
turns out that the WINDOWs in the other SCREENs have all been adjusted
to the new size of the resized SCREEN.   Now the WINDOW's size can be
out of sync with its own SCREEN.  The crash actually occurs in
_nc_hash_map, when the line index i goes past the end of the window's
line array if it is smaller than expected.

This is happening because the functions increase_size() and
decrease_size() in resizeterm.c walk the global window list using "for
(each_window(wp))", but they do not check if each window belongs to
the current screen before they apply the adjustment for the one screen
that got resized.

I've made a quick fix that seems to fix the problem.  The attached
diff shows the change.

This is from ncurses 5.7.  My platform is Arch Linux.

-- Scott

Attachment: resizeterm.c.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]