Skip to content

Commit 0929f5e

Browse files
committed
updated for version 7.4.100
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.
1 parent 1c83605 commit 0929f5e

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

src/regexp_nfa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4278,7 +4278,7 @@ addstate(l, state, subs_arg, pim, off)
42784278
* endless loop for "\(\)*" */
42794279

42804280
default:
4281-
if (state->lastlist[nfa_ll_index] == l->id)
4281+
if (state->lastlist[nfa_ll_index] == l->id && state->c != NFA_SKIP)
42824282
{
42834283
/* This state is already in the list, don't add it again,
42844284
* unless it is an MOPEN that is used for a backreference or

src/testdir/test64.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ STARTTEST
406406
:call add(tl, [2, '^.*\.\(.*\)/.\+\(\1\)\@<!$', 'foo.bat/foo.bat'])
407407
:call add(tl, [2, '^.*\.\(.*\)/.\+\(\1\)\@<=$', 'foo.bat/foo.bat', 'foo.bat/foo.bat', 'bat', 'bat'])
408408
:call add(tl, [2, '\\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}', '2013-06-27${0}', '${0}', '0'])
409+
:call add(tl, [2, '^\(a*\)\1$', 'aaaaaaaa', 'aaaaaaaa', 'aaaa'])
409410
:"
410411
:"""" Look-behind with limit
411412
:call add(tl, [2, '<\@<=span.', 'xxspanxx<spanyyy', 'spany'])

src/testdir/test64.ok

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,9 @@ OK 2 - ^.*\.\(.*\)/.\+\(\1\)\@<=$
944944
OK 0 - \\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}
945945
OK 1 - \\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}
946946
OK 2 - \\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}
947+
OK 0 - ^\(a*\)\1$
948+
OK 1 - ^\(a*\)\1$
949+
OK 2 - ^\(a*\)\1$
947950
OK 0 - <\@<=span.
948951
OK 1 - <\@<=span.
949952
OK 2 - <\@<=span.

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
100,
741743
/**/
742744
99,
743745
/**/

0 commit comments

Comments
 (0)