From dfd050867b92718ff025fffe81a581b1da1511ae Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 24 Jun 2019 23:31:33 -0400 Subject: vim-patch:8.1.0437: may access freed memory when syntax HL times out Problem: May access freed memory when syntax HL times out. (Philipp Gesang) Solution: Clear b_sst_first when clearing b_sst_array. https://github.com/vim/vim/commit/95892c27b242cdbc78e622c7a861a4e15aec7a30 --- src/nvim/syntax.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 418756abc4..4d3003a1fa 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -997,6 +997,7 @@ static void syn_stack_free_block(synblock_T *block) clear_syn_state(p); } XFREE_CLEAR(block->b_sst_array); + block->b_sst_first = NULL; block->b_sst_len = 0; } } @@ -1108,9 +1109,6 @@ static void syn_stack_apply_changes_block(synblock_T *block, buf_T *buf) synstate_T *p, *prev, *np; linenr_T n; - if (block->b_sst_array == NULL) /* nothing to do */ - return; - prev = NULL; for (p = block->b_sst_first; p != NULL; ) { if (p->sst_lnum + block->b_syn_sync_linebreaks > buf->b_mod_top) { @@ -1158,8 +1156,9 @@ static int syn_stack_cleanup(void) int dist; int retval = FALSE; - if (syn_block->b_sst_array == NULL || syn_block->b_sst_first == NULL) + if (syn_block->b_sst_first == NULL) { return retval; + } /* Compute normal distance between non-displayed entries. */ if (syn_block->b_sst_len <= Rows) -- cgit From e7901301d3bb118fb0e737c9a037ec13e97bc999 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 24 Jun 2019 23:36:56 -0400 Subject: vim-patch:8.1.0198: there is no hint that syntax is disabled for 'redrawtime' Problem: There is no hint that syntax is disabled for 'redrawtime'. Solution: Add a message. https://github.com/vim/vim/commit/0a6efcd27d62935c465b4406c0c0db9be10a0ddb --- src/nvim/syntax.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 4d3003a1fa..38d0e33948 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -2922,8 +2922,9 @@ static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T if (r > 0) ++st->match; } - if (timed_out) { + if (timed_out && !syn_win->w_s->b_syn_slow) { syn_win->w_s->b_syn_slow = true; + MSG(_("'redrawtime' exceeded, syntax highlighting disabled")); } if (r > 0) { @@ -3123,11 +3124,11 @@ static void syn_cmd_iskeyword(exarg_T *eap, int syncing) arg = skipwhite(arg); if (*arg == NUL) { MSG_PUTS("\n"); - MSG_PUTS(_("syntax iskeyword ")); if (curwin->w_s->b_syn_isk != empty_option) { + MSG_PUTS(_("syntax iskeyword ")); msg_outtrans(curwin->w_s->b_syn_isk); } else { - msg_outtrans((char_u *)"not set"); + msg_outtrans((char_u *)_("syntax iskeyword not set")); } } else { if (STRNICMP(arg, "clear", 5) == 0) { -- cgit From 56a96d8f8299c9b29bb3ed2e35efde3086c322dc Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 24 Jun 2019 23:43:56 -0400 Subject: vim-patch:8.0.1535: C syntax test still fails when using gvim Problem: C syntax test still fails when using gvim. Solution: Clear Normal cterm highlighting instead of setting it. https://github.com/vim/vim/commit/6acadda8d60892ddf06449f1cc4286912b0c0c2b --- src/nvim/testdir/test_syntax.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index 850947f89f..a3de879b2a 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -466,6 +466,8 @@ func Test_bg_detection() set bg=dark hi Normal ctermbg=12 call assert_equal('dark', &bg) + + hi Normal ctermbg=NONE endfunc fun Test_synstack_synIDtrans() -- cgit From ace7e4e11ba18b769aa028d73808b9405ec5e437 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 25 Jun 2019 00:19:46 -0400 Subject: vim-patch:8.1.1342: using freed memory when joining line with text property Problem: Using freed memory when joining line with text property. Solution: Use already computed length. https://github.com/vim/vim/commit/787880a86dbcb79cdf6e8241b1d99ac4a7acbc09 --- src/nvim/ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ops.c b/src/nvim/ops.c index b5408fab9a..b96e075f66 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -3749,7 +3749,7 @@ int do_join(size_t count, if (setmark) { // Set the '] mark. curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum; - curwin->w_buffer->b_op_end.col = (colnr_T)STRLEN(newp); + curwin->w_buffer->b_op_end.col = sumsize; } /* Only report the change in the first line here, del_lines() will report -- cgit