diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-11-27 13:37:10 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-11-27 13:37:10 +0100 |
commit | cbdf0a0b4adc19fb443bb7df542578c3e76970ce (patch) | |
tree | 6e58956896447bc1fe45a2e8d7b578f9dc438024 /src/screen.c | |
parent | 8c731505b094bdad100484373387b4c4658300d5 (diff) | |
download | vim-git-cbdf0a0b4adc19fb443bb7df542578c3e76970ce.tar.gz |
updated for version 7.4.528v7.4.528
Problem: Crash when using matchadd() (Yasuhiro Matsumoto)
Solution: Copy the match regprog.
Diffstat (limited to 'src/screen.c')
-rw-r--r-- | src/screen.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/screen.c b/src/screen.c index e11bdc377..d39513862 100644 --- a/src/screen.c +++ b/src/screen.c @@ -7588,6 +7588,12 @@ next_search_hl(win, shl, lnum, mincol, cur) shl->lnum = lnum; if (shl->rm.regprog != NULL) { + /* Remember whether shl->rm is using a copy of the regprog in + * cur->match. */ + int regprog_is_copy = (shl != &search_hl && cur != NULL + && shl == &cur->hl + && cur->match.regprog == cur->hl.rm.regprog); + nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol, #ifdef FEAT_RELTIME @@ -7596,6 +7602,10 @@ next_search_hl(win, shl, lnum, mincol, cur) NULL #endif ); + /* Copy the regprog, in case it got freed and recompiled. */ + if (regprog_is_copy) + cur->match.regprog = cur->hl.rm.regprog; + if (called_emsg || got_int) { /* Error while handling regexp: stop using this regexp. */ |