summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2010-01-04 15:55:46 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2010-01-04 15:55:46 +0000
commit85793c7d127584777548ffbe263a0dcaf2d34368 (patch)
tree4d26946b15060bde73fa6310721c55cbf28ef1af
parentcb91d5e16c65f408d68094e3cca3ce96acaeede4 (diff)
downloadpcre-85793c7d127584777548ffbe263a0dcaf2d34368.tar.gz
Fix partial match bug (code omitted) for \W.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@482 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog3
-rw-r--r--pcre_exec.c14
-rw-r--r--testdata/testinput53
-rw-r--r--testdata/testoutput54
4 files changed, 19 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 70c9535..87feb0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -88,6 +88,9 @@ Version 8.01 11-Dec-09
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.
diff --git a/pcre_exec.c b/pcre_exec.c
index 3daa38f..c3bb970 100644
--- a/pcre_exec.c
+++ b/pcre_exec.c
@@ -1134,7 +1134,7 @@ for (;;)
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 @@ for (;;)
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,8 +3695,12 @@ for (;;)
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);
}
diff --git a/testdata/testinput5 b/testdata/testinput5
index 82818d7..68795e6 100644
--- a/testdata/testinput5
+++ b/testdata/testinput5
@@ -742,4 +742,7 @@ can't tell the difference.) --/
xxxxabcde\P
xxxxabcde\P\P
+/X\W{3}X/8
+ \PX
+
/-- End of testinput5 --/
diff --git a/testdata/testoutput5 b/testdata/testoutput5
index f5de747..9d815ff 100644
--- a/testdata/testoutput5
+++ b/testdata/testoutput5
@@ -2072,4 +2072,8 @@ Partial match: abca
xxxxabcde\P\P
Partial match: abcde
+/X\W{3}X/8
+ \PX
+Partial match: X
+
/-- End of testinput5 --/