From 43a8242cd538ebdb838007dc3d303a37e2bc9944 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 9 Aug 2019 18:21:52 -0400 Subject: vim-patch:8.1.1458: crash when using gtags #10704 Problem: Crash when using gtags. (issue vim/vim#4102) Solution: Check for negative row or col in screen_puts_len(). (Christian Brabandt) https://github.com/vim/vim/commit/0b4c9eddb5752d46b65d16e42230b1228f230f40 --- src/nvim/screen.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index fb019a4d2d..e2dee154df 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -5372,8 +5372,11 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, screen_adjust_grid(&grid, &row, &col); - // safety check - if (grid->chars == NULL || row >= grid->Rows || col >= grid->Columns) { + // Safety check. The check for negative row and column is to fix issue + // vim/vim#4102. TODO: find out why row/col could be negative. + if (grid->chars == NULL + || row >= grid->Rows || row < 0 + || col >= grid->Columns || col < 0) { return; } -- cgit