Revision: 482
http://vcs.pcre.org/viewvc?view=rev&revision=482
Author: ph10
Date: 2010-01-04 15:55:46 +0000 (Mon, 04 Jan 2010)
Log Message:
-----------
Fix partial match bug (code omitted) for \W.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/pcre_exec.c
code/trunk/testdata/testinput5
code/trunk/testdata/testoutput5
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2010-01-03 17:45:53 UTC (rev 481)
+++ code/trunk/ChangeLog 2010-01-04 15:55:46 UTC (rev 482)
@@ -88,6 +88,9 @@
interpreted as invalid octal numbers. I've updated the previous comment in
configure.ac, and also added a check that gives an error if 08 or 09 are
used.
+
+14. Change 8.00/11 was not quite complete: code had been accidentally omitted,
+ causing partial matching to fail where the end of the subject matched \W.
Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c 2010-01-03 17:45:53 UTC (rev 481)
+++ code/trunk/pcre_exec.c 2010-01-04 15:55:46 UTC (rev 482)
@@ -1134,7 +1134,7 @@
continue;
/* Negative assertion: all branches must fail to match. Encountering SKIP,
- PRUNE, or COMMIT means we must assume failure without checking subsequent
+ PRUNE, or COMMIT means we must assume failure without checking subsequent
branches. */
case OP_ASSERT_NOT:
@@ -1147,8 +1147,8 @@
if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT)
{
do ecode += GET(ecode,1); while (*ecode == OP_ALT);
- break;
- }
+ break;
+ }
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
ecode += GET(ecode,1);
}
@@ -3695,9 +3695,13 @@
case OP_NOT_WORDCHAR:
for (i = 1; i <= min; i++)
{
- if (eptr >= md->end_subject ||
- (*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0))
+ if (eptr >= md->end_subject)
+ {
+ SCHECK_PARTIAL();
RRETURN(MATCH_NOMATCH);
+ }
+ if (*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0)
+ RRETURN(MATCH_NOMATCH);
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80);
}
break;
Modified: code/trunk/testdata/testinput5
===================================================================
--- code/trunk/testdata/testinput5 2010-01-03 17:45:53 UTC (rev 481)
+++ code/trunk/testdata/testinput5 2010-01-04 15:55:46 UTC (rev 482)
@@ -742,4 +742,7 @@
xxxxabcde\P
xxxxabcde\P\P
+/X\W{3}X/8
+ \PX
+
/-- End of testinput5 --/
Modified: code/trunk/testdata/testoutput5
===================================================================
--- code/trunk/testdata/testoutput5 2010-01-03 17:45:53 UTC (rev 481)
+++ code/trunk/testdata/testoutput5 2010-01-04 15:55:46 UTC (rev 482)
@@ -2072,4 +2072,8 @@
xxxxabcde\P\P
Partial match: abcde
+/X\W{3}X/8
+ \PX
+Partial match: X
+
/-- End of testinput5 --/