aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-08 15:10:18 -0700
committerGitHub <noreply@github.com>2019-09-08 15:10:18 -0700
commitccd947ca4a25edb59e00724d6fb20fb01f3b73f7 (patch)
tree87f69fb031fb2ee77f1c7ee64144bbc48ad70236
parentd91f4cd7d0b9778ad8ed630d5b8dc6b197513f51 (diff)
downloadrneovim-ccd947ca4a25edb59e00724d6fb20fb01f3b73f7.tar.gz
rneovim-ccd947ca4a25edb59e00724d6fb20fb01f3b73f7.tar.bz2
rneovim-ccd947ca4a25edb59e00724d6fb20fb01f3b73f7.zip
vim-patch:8.0.0970: passing invalid highlight id #10972
(We don't implement StatusLineTerm{NC}, but this patch seems generally relevant.) Problem: if there is no StatusLine highlighting and there is StatusLineNC or StatusLineTermNC highlighting then an invalid highlight id is passed to combine_stl_hlt(). (Coverity) Solution: Check id_S to be -1 instead of zero. https://github.com/vim/vim/commit/d6a7b3e6bbb8f87507de68d86cf70eab806aab3a
-rw-r--r--src/nvim/syntax.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 281ea7c4a3..16eff6db31 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -7559,14 +7559,15 @@ void highlight_changed(void)
}
}
- /* Setup the user highlights
- *
- * Temporarily utilize 10 more hl entries. Have to be in there
- * simultaneously in case of table overflows in get_attr_entry()
- */
+ //
+ // Setup the user highlights
+ //
+ // Temporarily utilize 10 more hl entries. Must be in there
+ // simultaneously in case of table overflows in get_attr_entry()
+ //
ga_grow(&highlight_ga, 10);
hlcnt = highlight_ga.ga_len;
- if (id_S == 0) { /* Make sure id_S is always valid to simplify code below */
+ if (id_S == -1) { // Make sure id_S is always valid to simplify code below.
memset(&HL_TABLE()[hlcnt + 9], 0, sizeof(struct hl_group));
id_S = hlcnt + 10;
}
@@ -7590,7 +7591,7 @@ void highlight_changed(void)
sizeof(struct hl_group));
hlt[hlcnt + i].sg_link = 0;
- /* Apply difference between UserX and HLF_S to HLF_SNC */
+ // Apply difference between UserX and HLF_S to HLF_SNC.
hlt[hlcnt + i].sg_cterm ^= hlt[id - 1].sg_cterm ^ hlt[id_S - 1].sg_cterm;
if (hlt[id - 1].sg_cterm_fg != hlt[id_S - 1].sg_cterm_fg) {