]> granicus.if.org Git - vim/commitdiff
patch 8.1.0437: may access freed memory when syntax HL times out v8.1.0437
authorBram Moolenaar <Bram@vim.org>
Fri, 28 Sep 2018 20:26:54 +0000 (22:26 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 28 Sep 2018 20:26:54 +0000 (22:26 +0200)
Problem:    May access freed memory when syntax HL times out. (Philipp Gesang)
Solution:   Clear b_sst_first when clearing b_sst_array.

src/syntax.c
src/version.c

index 8fb4e20e5052f717642528fc268017692f8acf80..e54ec9a82630c276ae6f7cec47f37d1e55f22ad1 100644 (file)
@@ -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. */
index 7f21f2d8099e91ed7b6cd4e9ba6b5f2f4661095e..55d3d8013f87a3fdf38eacb91b2fe468fc318055 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    437,
 /**/
     436,
 /**/