Mercurial > vim
diff src/libvterm/src/screen.c @ 20957:2f2bc98a8dfb v8.2.1030
patch 8.2.1030: reducing size of a terminal window may cause a crash
Commit: https://github.com/vim/vim/commit/da58134eedf43ae4b9013c93ecbdf55e4da4b8a3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 21 17:57:32 2020 +0200
patch 8.2.1030: reducing size of a terminal window may cause a crash
Problem: Reducing size of a terminal window may cause a crash.
Solution: Make sure the row and column don't become negative. (closes https://github.com/vim/vim/issues/6273)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 21 Jun 2020 18:00:04 +0200 |
parents | 88cec48503b8 |
children | 66618893eb2a |
line wrap: on
line diff
--- a/src/libvterm/src/screen.c +++ b/src/libvterm/src/screen.c @@ -646,6 +646,12 @@ static int setlineinfo(int row, const VT newinfo->doubleheight != oldinfo->doubleheight) { for(col = 0; col < screen->cols; col++) { ScreenCell *cell = getcell(screen, row, col); + if (cell == NULL) + { + DEBUG_LOG2("libvterm: setlineinfo() position invalid: %d / %d", + row, col); + return 1; + } cell->pen.dwl = newinfo->doublewidth; cell->pen.dhl = newinfo->doubleheight; } @@ -773,6 +779,12 @@ static size_t _get_chars(const VTermScre ScreenCell *cell = getcell(screen, row, col); int i; + if (cell == NULL) + { + DEBUG_LOG2("libvterm: _get_chars() position invalid: %d / %d", + row, col); + return 1; + } if(cell->chars[0] == 0) // Erased cell, might need a space padding++;