|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.421
|
|
|
22c937 |
Fcc: outbox
|
|
|
22c937 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
22c937 |
Mime-Version: 1.0
|
|
|
22c937 |
Content-Type: text/plain; charset=UTF-8
|
|
|
22c937 |
Content-Transfer-Encoding: 8bit
|
|
|
22c937 |
------------
|
|
|
22c937 |
|
|
|
22c937 |
Patch 7.4.421
|
|
|
22c937 |
Problem: Crash when searching for "\ze*". (Urtica Dioica)
|
|
|
22c937 |
Solution: Disallow a multi after \ze and \zs.
|
|
|
22c937 |
Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.420/src/regexp_nfa.c 2014-05-13 19:37:19.489786520 +0200
|
|
|
22c937 |
--- src/regexp_nfa.c 2014-08-29 11:14:12.030416520 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 291,296 ****
|
|
|
22c937 |
--- 291,297 ----
|
|
|
22c937 |
static int nfa_regconcat __ARGS((void));
|
|
|
22c937 |
static int nfa_regbranch __ARGS((void));
|
|
|
22c937 |
static int nfa_reg __ARGS((int paren));
|
|
|
22c937 |
+ static int re_mult_next __ARGS((char *what));
|
|
|
22c937 |
#ifdef DEBUG
|
|
|
22c937 |
static void nfa_set_code __ARGS((int c));
|
|
|
22c937 |
static void nfa_postfix_dump __ARGS((char_u *expr, int retval));
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1323,1332 ****
|
|
|
22c937 |
--- 1324,1337 ----
|
|
|
22c937 |
{
|
|
|
22c937 |
case 's':
|
|
|
22c937 |
EMIT(NFA_ZSTART);
|
|
|
22c937 |
+ if (re_mult_next("\\zs") == FAIL)
|
|
|
22c937 |
+ return FAIL;
|
|
|
22c937 |
break;
|
|
|
22c937 |
case 'e':
|
|
|
22c937 |
EMIT(NFA_ZEND);
|
|
|
22c937 |
nfa_has_zend = TRUE;
|
|
|
22c937 |
+ if (re_mult_next("\\ze") == FAIL)
|
|
|
22c937 |
+ return FAIL;
|
|
|
22c937 |
break;
|
|
|
22c937 |
#ifdef FEAT_SYN_HL
|
|
|
22c937 |
case '1':
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2276,2281 ****
|
|
|
22c937 |
--- 2281,2298 ----
|
|
|
22c937 |
return OK;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
+ /*
|
|
|
22c937 |
+ * Used in a place where no * or \+ can follow.
|
|
|
22c937 |
+ */
|
|
|
22c937 |
+ static int
|
|
|
22c937 |
+ re_mult_next(what)
|
|
|
22c937 |
+ char *what;
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ if (re_multi_type(peekchr()) == MULTI_MULT)
|
|
|
22c937 |
+ EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what);
|
|
|
22c937 |
+ return OK;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
#ifdef DEBUG
|
|
|
22c937 |
static char_u code[50];
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.420/src/testdir/test64.in 2014-05-13 16:44:25.633695709 +0200
|
|
|
22c937 |
--- src/testdir/test64.in 2014-08-29 11:33:12.330419011 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 459,465 ****
|
|
|
22c937 |
: let text = t[2]
|
|
|
22c937 |
: let matchidx = 3
|
|
|
22c937 |
: for engine in [0, 1, 2]
|
|
|
22c937 |
! : if engine == 2 && re == 0 || engine == 1 && re ==1
|
|
|
22c937 |
: continue
|
|
|
22c937 |
: endif
|
|
|
22c937 |
: let ®expengine = engine
|
|
|
22c937 |
--- 459,465 ----
|
|
|
22c937 |
: let text = t[2]
|
|
|
22c937 |
: let matchidx = 3
|
|
|
22c937 |
: for engine in [0, 1, 2]
|
|
|
22c937 |
! : if engine == 2 && re == 0 || engine == 1 && re == 1
|
|
|
22c937 |
: continue
|
|
|
22c937 |
: endif
|
|
|
22c937 |
: let ®expengine = engine
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 608,613 ****
|
|
|
22c937 |
--- 608,624 ----
|
|
|
22c937 |
"ayb20gg/..\%$
|
|
|
22c937 |
"bybGo?"apo?"bp:"
|
|
|
22c937 |
:"
|
|
|
22c937 |
+ :" Check for detecting error
|
|
|
22c937 |
+ :set regexpengine=2
|
|
|
22c937 |
+ :for pat in [' \ze*', ' \zs*']
|
|
|
22c937 |
+ : try
|
|
|
22c937 |
+ : let l = matchlist('x x', pat)
|
|
|
22c937 |
+ : $put ='E888 NOT detected for ' . pat
|
|
|
22c937 |
+ : catch
|
|
|
22c937 |
+ : $put ='E888 detected for ' . pat
|
|
|
22c937 |
+ : endtry
|
|
|
22c937 |
+ :endfor
|
|
|
22c937 |
+ :"
|
|
|
22c937 |
:""""" Write the results """""""""""""
|
|
|
22c937 |
:/\%#=1^Results/,$wq! test.out
|
|
|
22c937 |
ENDTEST
|
|
|
22c937 |
*** ../vim-7.4.420/src/testdir/test64.ok 2014-05-13 16:44:25.633695709 +0200
|
|
|
22c937 |
--- src/testdir/test64.ok 2014-08-29 11:36:05.782419390 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1097,1099 ****
|
|
|
22c937 |
--- 1097,1101 ----
|
|
|
22c937 |
Test END
|
|
|
22c937 |
EN
|
|
|
22c937 |
E
|
|
|
22c937 |
+ E888 detected for \ze*
|
|
|
22c937 |
+ E888 detected for \zs*
|
|
|
22c937 |
*** ../vim-7.4.420/src/version.c 2014-08-29 10:04:32.226407390 +0200
|
|
|
22c937 |
--- src/version.c 2014-08-29 11:37:15.794419543 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 743,744 ****
|
|
|
22c937 |
--- 743,746 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 421,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
From "know your smileys":
|
|
|
22c937 |
:----} You lie like Pinocchio
|
|
|
22c937 |
|
|
|
22c937 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
22c937 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
22c937 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
22c937 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|