summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-01-17 14:43:23 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-01-17 14:43:23 +0000
commite2ea7c3e55bbc6b80e9ed17cf760594348f25ec2 (patch)
tree705ece08f4c11b0331ecc555cc7db46d105bd70c
parent107eef07bc3e949c11c280d8e8c34a2dde295b54 (diff)
downloadpcre-e2ea7c3e55bbc6b80e9ed17cf760594348f25ec2.tar.gz
Fix MARK bug for assertions.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@888 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog3
-rw-r--r--pcre_exec.c4
-rw-r--r--testdata/testinput26
-rw-r--r--testdata/testoutput212
4 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 267be72..9cbc89d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,7 +42,8 @@ Version 8.30
"x". The similar pattern /(?=(*:x))((*:y)q|)/ did not return a mark at all.
Oddly, Perl behaves the same way. PCRE has been fixed so that this pattern
also returns the mark "x". This bug applied to capturing parentheses,
- non-capturing parentheses, and atomic parentheses.
+ non-capturing parentheses, and atomic parentheses. It also applied to some
+ assertions.
12. Stephen Kelly's patch to CMakeLists.txt allows it to parse the version
information out of configure.ac instead of relying on pcre.h.generic, which
diff --git a/pcre_exec.c b/pcre_exec.c
index d5363fb..252ad6f 100644
--- a/pcre_exec.c
+++ b/pcre_exec.c
@@ -1530,6 +1530,7 @@ for (;;)
case OP_ASSERT:
case OP_ASSERTBACK:
+ save_mark = md->mark;
if (md->match_function_type == MATCH_CONDASSERT)
{
condassert = TRUE;
@@ -1551,6 +1552,7 @@ for (;;)
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
ecode += GET(ecode, 1);
+ md->mark = save_mark;
}
while (*ecode == OP_ALT);
@@ -1574,6 +1576,7 @@ for (;;)
case OP_ASSERT_NOT:
case OP_ASSERTBACK_NOT:
+ save_mark = md->mark;
if (md->match_function_type == MATCH_CONDASSERT)
{
condassert = TRUE;
@@ -1584,6 +1587,7 @@ for (;;)
do
{
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, NULL, RM5);
+ md->mark = save_mark;
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) RRETURN(MATCH_NOMATCH);
if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT)
{
diff --git a/testdata/testinput2 b/testdata/testinput2
index b8483e2..bdae889 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -3595,4 +3595,10 @@ replaced by single letters. --/
/(?=(*:x))(?>(*:y)q|)/K+
abc
+/(?=a(*:x))(?!a(*:y)c)/K+
+ ab
+
+/(?=a(*:x))(?=a(*:y)c|)/K+
+ ab
+
/-- End of testinput2 --/
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 841b55f..6d94c09 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -11999,4 +11999,16 @@ MK: x
0+ abc
MK: x
+/(?=a(*:x))(?!a(*:y)c)/K+
+ ab
+ 0:
+ 0+ ab
+MK: x
+
+/(?=a(*:x))(?=a(*:y)c|)/K+
+ ab
+ 0:
+ 0+ ab
+MK: x
+
/-- End of testinput2 --/