diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-09-28 22:26:54 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-09-28 22:26:54 +0200 |
commit | 95892c27b242cdbc78e622c7a861a4e15aec7a30 (patch) | |
tree | 12b787a31c0d131fc1fb75b7b5ebdecc00c04e41 /src/syntax.c | |
parent | ee91c33570008aefd2d62b8f88b22db751acacbe (diff) | |
download | vim-git-95892c27b242cdbc78e622c7a861a4e15aec7a30.tar.gz |
patch 8.1.0437: may access freed memory when syntax HL times outv8.1.0437
Problem: May access freed memory when syntax HL times out. (Philipp Gesang)
Solution: Clear b_sst_first when clearing b_sst_array.
Diffstat (limited to 'src/syntax.c')
-rw-r--r-- | src/syntax.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/syntax.c b/src/syntax.c index 8fb4e20e5..e54ec9a82 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -1192,6 +1192,7 @@ syn_stack_free_block(synblock_T *block) for (p = block->b_sst_first; p != NULL; p = p->sst_next) clear_syn_state(p); VIM_CLEAR(block->b_sst_array); + block->b_sst_first = NULL; block->b_sst_len = 0; } } @@ -1323,9 +1324,6 @@ 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; ) { @@ -1378,7 +1376,7 @@ 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. */ |