]> granicus.if.org Git - vim/commitdiff
patch 8.0.1517: invalid memory acces with pattern using look-behind match v8.0.1517
authorBram Moolenaar <Bram@vim.org>
Tue, 13 Feb 2018 15:35:06 +0000 (16:35 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 13 Feb 2018 15:35:06 +0000 (16:35 +0100)
Problem:    Invalid memory acces with pattern using look-behind match.
            (Dominique Pelle)
Solution:   Get a pointer to the right line.

src/regexp.c
src/version.c

index d07391eefb93984ff88a15638a1948c195766e5a..b1cad99c3332a386ba235a064b982baf13d7e411 100644 (file)
@@ -5585,9 +5585,14 @@ regmatch(
                    {
 #ifdef FEAT_MBYTE
                        if (has_mbyte)
+                       {
+                           char_u *line =
+                                        reg_getline(behind_pos.rs_u.pos.lnum);
+
                            rp->rs_un.regsave.rs_u.pos.col -=
-                               (*mb_head_off)(regline, regline
+                               (*mb_head_off)(line, line
                                    + rp->rs_un.regsave.rs_u.pos.col - 1) + 1;
+                       }
                        else
 #endif
                            --rp->rs_un.regsave.rs_u.pos.col;
index 9e1983342ea837235c30e879724a837076b91918..931037d3d3516fbfff48997aa1e8eccf931dec8f 100644 (file)
@@ -771,6 +771,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1517,
 /**/
     1516,
 /**/