]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.421 v7.4.421
authorBram Moolenaar <Bram@vim.org>
Fri, 29 Aug 2014 09:56:32 +0000 (11:56 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 29 Aug 2014 09:56:32 +0000 (11:56 +0200)
Problem:    Crash when searching for "\ze*". (Urtica Dioica)
Solution:   Disallow a multi after \ze and \zs.

src/regexp_nfa.c
src/testdir/test64.in
src/testdir/test64.ok
src/version.c

index a7fbe7b254f5041f237cac4d7835b28473621c9b..4ccb05a2b3bdaefdfd3883306326bfc939f2c7f9 100644 (file)
@@ -291,6 +291,7 @@ static int nfa_regpiece __ARGS((void));
 static int nfa_regconcat __ARGS((void));
 static int nfa_regbranch __ARGS((void));
 static int nfa_reg __ARGS((int paren));
+static int re_mult_next __ARGS((char *what));
 #ifdef DEBUG
 static void nfa_set_code __ARGS((int c));
 static void nfa_postfix_dump __ARGS((char_u *expr, int retval));
@@ -1323,10 +1324,14 @@ nfa_regatom()
            {
                case 's':
                    EMIT(NFA_ZSTART);
+                   if (re_mult_next("\\zs") == FAIL)
+                       return FAIL;
                    break;
                case 'e':
                    EMIT(NFA_ZEND);
                    nfa_has_zend = TRUE;
+                   if (re_mult_next("\\ze") == FAIL)
+                       return FAIL;
                    break;
 #ifdef FEAT_SYN_HL
                case '1':
@@ -2276,6 +2281,18 @@ nfa_reg(paren)
     return OK;
 }
 
+/*
+ * Used in a place where no * or \+ can follow.
+ */
+    static int
+re_mult_next(what)
+    char *what;
+{
+    if (re_multi_type(peekchr()) == MULTI_MULT)
+       EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what);
+    return OK;
+}
+
 #ifdef DEBUG
 static char_u code[50];
 
index 2abdcd1c082e8e48a6a2f0a11e9d55a01193b3fc..f2452fc0f3ad26e2f1a4a09a4168ee2beddc371e 100644 (file)
@@ -459,7 +459,7 @@ STARTTEST
 :  let text = t[2]
 :  let matchidx = 3
 :  for engine in [0, 1, 2]
-:    if engine == 2 && re == 0 || engine == 1 && re ==1
+:    if engine == 2 && re == 0 || engine == 1 && re == 1
 :      continue
 :    endif
 :    let &regexpengine = engine
@@ -608,6 +608,17 @@ yeGo\epA END\e:"
 "ayb20gg/..\%$
 "bybGo\e"apo\e"bp:"
 :"
+:" Check for detecting error
+:set regexpengine=2
+:for pat in [' \ze*', ' \zs*']
+:  try
+:    let l = matchlist('x x', pat)
+:    $put ='E888 NOT detected for ' . pat
+:  catch
+:    $put ='E888 detected for ' . pat
+:  endtry
+:endfor
+:"
 :""""" Write the results """""""""""""
 :/\%#=1^Results/,$wq! test.out
 ENDTEST
index e7d173141adf89a3136b6ed371761b4769aad3dd..ffc0b5341f3bdf942abe452ea43e6c77d29bcef8 100644 (file)
@@ -1097,3 +1097,5 @@ Test
 Test END
 EN
 E
+E888 detected for  \ze*
+E888 detected for  \zs*
index a34bef22b269d951d42fb67135f978eb75fb2b56..d047c9b8db27fe46334c547f2e2221149a95479a 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    421,
 /**/
     420,
 /**/