summaryrefslogtreecommitdiff
path: root/src/regexp_nfa.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-08-29 11:56:32 +0200
committerBram Moolenaar <Bram@vim.org>2014-08-29 11:56:32 +0200
commit2d46e6075ba3aa369172e610782810b9ac3f1f4b (patch)
tree82015972dbb87c03b480a2f0eb305fa216803f20 /src/regexp_nfa.c
parenta9537d238e8c2fe9afb9bbf4e137734372b7d9ba (diff)
downloadvim-git-2d46e6075ba3aa369172e610782810b9ac3f1f4b.tar.gz
updated for version 7.4.421v7.4.421
Problem: Crash when searching for "\ze*". (Urtica Dioica) Solution: Disallow a multi after \ze and \zs.
Diffstat (limited to 'src/regexp_nfa.c')
-rw-r--r--src/regexp_nfa.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index a7fbe7b25..4ccb05a2b 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -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];