| To: vim_dev@googlegroups.com |
| Subject: Patch 7.4.528 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.4.528 |
| Problem: Crash when using matchadd() (Yasuhiro Matsumoto) |
| Solution: Copy the match regprog. |
| Files: src/screen.c |
| |
| |
| |
| |
| |
| *** 7588,7593 **** |
| --- 7588,7599 ---- |
| 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,7601 **** |
| --- 7602,7611 ---- |
| 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. */ |
| |
| |
| |
| *** 743,744 **** |
| --- 743,746 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 528, |
| /**/ |
| |
| -- |
| FATAL ERROR! SYSTEM HALTED! - Press any key to continue doing nothing. |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ an exciting new programming language -- http://www.Zimbu.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |