Skip to content

Commit

Permalink
updated for version 7.4.100
Browse files Browse the repository at this point in the history
Problem:    NFA regexp doesn't handle backreference correctly. (Ryuichi
            Hayashida, Urtica Dioica)
Solution:   Always add NFA_SKIP, also when it already exists at the start
            position.
  • Loading branch information
brammool committed Nov 21, 2013
1 parent cafaa8a commit 272fb58
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/regexp_nfa.c
Expand Up @@ -4278,7 +4278,7 @@ addstate(l, state, subs_arg, pim, off)
* endless loop for "\(\)*" */

default:
if (state->lastlist[nfa_ll_index] == l->id)
if (state->lastlist[nfa_ll_index] == l->id && state->c != NFA_SKIP)
{
/* This state is already in the list, don't add it again,
* unless it is an MOPEN that is used for a backreference or
Expand Down
1 change: 1 addition & 0 deletions src/testdir/test64.in
Expand Up @@ -406,6 +406,7 @@ STARTTEST
:call add(tl, [2, '^.*\.\(.*\)/.\+\(\1\)\@<!$', 'foo.bat/foo.bat'])
:call add(tl, [2, '^.*\.\(.*\)/.\+\(\1\)\@<=$', 'foo.bat/foo.bat', 'foo.bat/foo.bat', 'bat', 'bat'])
:call add(tl, [2, '\\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}', '2013-06-27${0}', '${0}', '0'])
:call add(tl, [2, '^\(a*\)\1$', 'aaaaaaaa', 'aaaaaaaa', 'aaaa'])
:"
:"""" Look-behind with limit
:call add(tl, [2, '<\@<=span.', 'xxspanxx<spanyyy', 'spany'])
Expand Down
3 changes: 3 additions & 0 deletions src/testdir/test64.ok
Expand Up @@ -944,6 +944,9 @@ OK 2 - ^.*\.\(.*\)/.\+\(\1\)\@<=$
OK 0 - \\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}
OK 1 - \\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}
OK 2 - \\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}
OK 0 - ^\(a*\)\1$
OK 1 - ^\(a*\)\1$
OK 2 - ^\(a*\)\1$
OK 0 - <\@<=span.
OK 1 - <\@<=span.
OK 2 - <\@<=span.
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -738,6 +738,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
100,
/**/
99,
/**/
Expand Down

0 comments on commit 272fb58

Please sign in to comment.