From 44635add18f7ef49f8d598123ec1d4ec61563e73 Mon Sep 17 00:00:00 2001 From: Scott Prager Date: Tue, 21 Oct 2014 11:08:35 -0400 Subject: vim-patch:7.4.421 Problem: Crash when searching for "\ze*". (Urtica Dioica) Solution: Disallow a multi after \ze and \zs. https://code.google.com/p/vim/source/detail?r=v7-4-421 --- src/nvim/regexp_nfa.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/nvim/regexp_nfa.c') diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 2659eac762..bbe96854ad 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -1259,10 +1259,16 @@ static int nfa_regatom(void) switch (c) { case 's': EMIT(NFA_ZSTART); + if (!re_mult_next("\\zs")) { + return false; + } break; case 'e': EMIT(NFA_ZEND); - nfa_has_zend = TRUE; + nfa_has_zend = true; + if (!re_mult_next("\\zs")) { + return false; + } break; case '1': case '2': @@ -1741,6 +1747,15 @@ nfa_do_multibyte: return OK; } +/// Used in a place where no * or \+ can follow. +static bool re_mult_next(char *what) +{ + if (re_multi_type(peekchr()) == MULTI_MULT) { + EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what); + } + return true; +} + /* * Parse something followed by possible [*+=]. * -- cgit From ca7c509ae0396be0b15c268b1b2e0600e796e322 Mon Sep 17 00:00:00 2001 From: Scott Prager Date: Sat, 25 Oct 2014 15:34:06 -0400 Subject: vim-patch:7.4.437 Problem: New and old regexp engine are not consistent. Solution: Also give an error for "\ze*" for the old regexp engine. https://code.google.com/p/vim/source/detail?r=v7-4-437 --- src/nvim/regexp_nfa.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/nvim/regexp_nfa.c') diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index bbe96854ad..9ae1740627 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -1747,15 +1747,6 @@ nfa_do_multibyte: return OK; } -/// Used in a place where no * or \+ can follow. -static bool re_mult_next(char *what) -{ - if (re_multi_type(peekchr()) == MULTI_MULT) { - EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what); - } - return true; -} - /* * Parse something followed by possible [*+=]. * -- cgit