• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisão66618893eb2af64f3f689e6ebd8ee0010f464a46 (tree)
Hora2020-08-02 22:15:03
AutorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Mensagem de Log

patch 8.2.1353: crash when drawing double-wide character in terminal window

Commit: https://github.com/vim/vim/commit/8b89614e69b9b2330539d0482e44f4724053e780
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 2 15:05:05 2020 +0200

patch 8.2.1353: crash when drawing double-wide character in terminal window
Problem: Crash when drawing double-wide character in terminal window.
(Masato Nishihata)
Solution: Check getcell() returning NULL. (issue #6141)

Mudança Sumário

Diff

diff -r e2e607fac96b -r 66618893eb2a src/libvterm/src/screen.c
--- a/src/libvterm/src/screen.c Sat Aug 01 23:30:03 2020 +0200
+++ b/src/libvterm/src/screen.c Sun Aug 02 15:15:03 2020 +0200
@@ -186,7 +186,12 @@
186186 cell->chars[i] = 0;
187187
188188 for(col = 1; col < info->width; col++)
189- getcell(screen, pos.row, pos.col + col)->chars[0] = (uint32_t)-1;
189+ {
190+ ScreenCell *onecell = getcell(screen, pos.row, pos.col + col);
191+ if (onecell == NULL)
192+ break;
193+ onecell->chars[0] = (uint32_t)-1;
194+ }
190195
191196 rect.start_row = pos.row;
192197 rect.end_row = pos.row+1;
diff -r e2e607fac96b -r 66618893eb2a src/testdir/test_terminal.vim
--- a/src/testdir/test_terminal.vim Sat Aug 01 23:30:03 2020 +0200
+++ b/src/testdir/test_terminal.vim Sun Aug 02 15:15:03 2020 +0200
@@ -258,6 +258,21 @@
258258 call delete('Xtext')
259259 endfunc
260260
261+func Test_terminal_one_column()
262+ " This creates a terminal, displays a double-wide character and makes the
263+ " window one column wide. This used to cause a crash.
264+ let width = &columns
265+ botright vert term
266+ let buf = bufnr('$')
267+ call term_wait(buf, 100)
268+ exe "set columns=" .. (width / 2)
269+ redraw
270+ call term_sendkeys(buf, "キ")
271+ call term_wait(buf, 10)
272+ exe "set columns=" .. width
273+ exe buf . 'bwipe!'
274+endfunc
275+
261276 func Test_terminal_scroll()
262277 call writefile(range(1, 200), 'Xtext')
263278 if has('win32')
diff -r e2e607fac96b -r 66618893eb2a src/version.c
--- a/src/version.c Sat Aug 01 23:30:03 2020 +0200
+++ b/src/version.c Sun Aug 02 15:15:03 2020 +0200
@@ -755,6 +755,8 @@
755755 static int included_patches[] =
756756 { /* Add new patch number below this line */
757757 /**/
758+ 1353,
759+/**/
758760 1352,
759761 /**/
760762 1351,
Show on old repository browser