summaryrefslogtreecommitdiffstats
path: root/src/regexp.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-02-13 16:35:06 +0100
committerBram Moolenaar <Bram@vim.org>2018-02-13 16:35:06 +0100
commitbc197195b097707d08fd44a476dbc374366504cb (patch)
tree0b5715c1de3f30c8b8a57f365619f5b526771e69 /src/regexp.c
parentb3292fa2d362b064ff8a115fc0ad794c1f1265d7 (diff)
patch 8.0.1517: invalid memory acces with pattern using look-behind matchv8.0.1517
Problem: Invalid memory acces with pattern using look-behind match. (Dominique Pelle) Solution: Get a pointer to the right line.
Diffstat (limited to 'src/regexp.c')
-rw-r--r--src/regexp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/regexp.c b/src/regexp.c
index d07391eefb..b1cad99c33 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -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;