- Prevent false matches when DFA is disabled (bug #138558).

This commit is contained in:
Tim Waugh 2004-11-10 09:42:35 +00:00
parent 553606aabf
commit acd16e9f79
2 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,5 @@
--- grep-2.5.1/src/search.c.dfa-optional 2004-11-07 20:04:26.181494244 +0000 --- grep-2.5.1/src/search.c 2004-11-07 20:11:07.437866925 +0000
+++ grep-2.5.1/src/search.c 2004-11-07 20:11:07.437866925 +0000 +++ grep-2.5.1/src/search.c 2004-11-10 09:40:44.994750111 +0000
@@ -305,11 +305,33 @@ @@ -305,11 +305,33 @@
int backref, start, len; int backref, start, len;
struct kwsmatch kwsm; struct kwsmatch kwsm;
@ -55,6 +55,15 @@
if (offset == (size_t) -1) if (offset == (size_t) -1)
break; break;
/* Narrow down to the line we've found. */ /* Narrow down to the line we've found. */
@@ -416,7 +441,7 @@
--beg;
}
/* Successful, no backreferences encountered! */
- if (!backref)
+ if (use_dfa && !backref)
goto success_in_beg_and_end;
}
else
@@ -450,7 +475,11 @@ @@ -450,7 +475,11 @@
if ((start == 0 || !WCHAR ((unsigned char) beg[start - 1])) if ((start == 0 || !WCHAR ((unsigned char) beg[start - 1]))
&& (len == end - beg - 1 && (len == end - beg - 1

View File

@ -83,6 +83,9 @@ fi
%{_mandir}/*/* %{_mandir}/*/*
%changelog %changelog
* Wed Nov 10 2004 Tim Waugh <twaugh@redhat.com>
- Prevent false matches when DFA is disabled (bug #138558).
* Mon Nov 8 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-36 * Mon Nov 8 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-36
- Automatically disable DFA when processing multibyte input. GREP_USE_DFA - Automatically disable DFA when processing multibyte input. GREP_USE_DFA
environment variable overrides. environment variable overrides.