]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0189: invalid memory access for text prop without highlight v9.0.0189
authorBram Moolenaar <Bram@vim.org>
Wed, 10 Aug 2022 19:50:23 +0000 (20:50 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 10 Aug 2022 19:50:23 +0000 (20:50 +0100)
Problem:    Invalid memory access for text prop without highlight.
Solution:   Check for a valid highlight ID.

src/drawline.c
src/highlight.c
src/version.c

index d38cf7347ba959cc885357403b9d48aa25cfc9a7..2b482bb2db3428c6a009fcac070878b2d73059bf 100644 (file)
@@ -1710,7 +1710,8 @@ win_line(
                                                  || text_props[tpi].tp_id < 0)
                                          && text_props[tpi].tp_id != -MAXCOL)
                        {
-                           used_attr = syn_id2attr(pt->pt_hl_id);
+                           if (pt->pt_hl_id > 0)
+                               used_attr = syn_id2attr(pt->pt_hl_id);
                            text_prop_type = pt;
                            text_prop_attr =
                                   hl_combine_attr(text_prop_attr, used_attr);
index 2542c7b2020892aac5227f46ec433bdd7e5f8a7a..c373afb957f4afb1267a344539eaf9f503814673 100644 (file)
@@ -3504,6 +3504,7 @@ syn_unadd_group(void)
 
 /*
  * Translate a group ID to highlight attributes.
+ * "hl_id" must be valid: > 0, caller must check.
  */
     int
 syn_id2attr(int hl_id)
index 6675c3a4a53468e48439f6043fa84fe182772667..03a8091e6ee2881dff8a46bb33d6129d9cfea712 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    189,
 /**/
     188,
 /**/