Skip to content

Commit 6394547

Browse files
Sergei Trofimovichaborodin
authored andcommitted
Ticket #4192: fix crash if shadow is out of screen.
(tty_clip): add extra tests for area boundaries. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
1 parent c7306aa commit 6394547

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/tty/tty-ncurses.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,16 @@ tty_clip (int *y, int *x, int *rows, int *cols)
152152

153153
if (*y + *rows > LINES)
154154
*rows = LINES - *y;
155+
156+
if (*rows <= 0)
157+
return FALSE;
158+
155159
if (*x + *cols > COLS)
156160
*cols = COLS - *x;
157161

162+
if (*cols <= 0)
163+
return FALSE;
164+
158165
return TRUE;
159166
}
160167

0 commit comments

Comments
 (0)