From cb708d203b36fff16b6f01a81c30ca20b51c82fc Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 10 Aug 2018 10:41:26 -0400 Subject: vim-patch:8.0.1517: invalid memory acces with pattern using look-behind match Problem: Invalid memory acces with pattern using look-behind match. (Dominique Pelle) Solution: Get a pointer to the right line. https://github.com/vim/vim/commit/bc197195b097707d08fd44a476dbc374366504cb --- src/nvim/regexp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/nvim/regexp.c') diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 9bfc158763..9d16ecb46c 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -4922,8 +4922,11 @@ regmatch ( } } else { if (has_mbyte) { + const char_u *const 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 { rp->rs_un.regsave.rs_u.pos.col--; -- cgit