aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIhor Antonov <ngortheone@users.noreply.github.com>2019-08-11 03:47:49 -0400
committerJustin M. Keyes <justinkz@gmail.com>2019-08-11 09:47:49 +0200
commite5d388f23a6809ba2bd600e813f2a4b0bdbd20c8 (patch)
tree15aed0840babf846a72497735a64a1c3bc93ca61
parentc190415dc29b518e87db9bcd2956933873bd81bf (diff)
downloadrneovim-e5d388f23a6809ba2bd600e813f2a4b0bdbd20c8.tar.gz
rneovim-e5d388f23a6809ba2bd600e813f2a4b0bdbd20c8.tar.bz2
rneovim-e5d388f23a6809ba2bd600e813f2a4b0bdbd20c8.zip
clang/"Argument with 'nonnull' attribute passed null" #10739
Problem: In screen.c grid_char_needs_redraw clang warns that grid->chars could be NULL Solution: Suggested by bfredl. Add explicit check grid->chars != NULL in grid_put_linebuf similar to grid_puts_len
-rw-r--r--src/nvim/screen.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index e2dee154df..99ccce1793 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -4374,6 +4374,12 @@ static void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol,
screen_adjust_grid(&grid, &row, &coloff);
+ // Safety check. Avoids clang warnings down the call stack.
+ if (grid->chars == NULL || row >= grid->Rows || col >= grid->Columns) {
+ DLOG("invalid state, skipped");
+ return;
+ }
+
off_from = 0;
off_to = grid->line_offset[row] + coloff;
max_off_from = linebuf_size;