From f9d7bc63bf55ed24239a784a15a04a27eca2f889 Mon Sep 17 00:00:00 2001 From: Brian Campbell Date: Sun, 26 Jun 2022 15:30:58 +0100 Subject: [PATCH] Fix underflow in free_window_info At the end this is called after `WIN_MESSAGE` is reset to `-1`, so we need a check here. --- win/tty/wintty.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 0b5225c69..76443417e 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1769,7 +1769,8 @@ free_window_info(struct WinDesc *cw, boolean free_data) int i; if (cw->data) { - if (cw == wins[WIN_MESSAGE] && cw->rows > cw->maxrow) + if (WIN_MESSAGE != WIN_ERR && cw == wins[WIN_MESSAGE] + && cw->rows > cw->maxrow) cw->maxrow = cw->rows; /* topl data */ for (i = 0; i < cw->maxrow; i++) if (cw->data[i]) {