|
|
191adc |
From 69285b9e6fa30790d5fc0bcb3d2bcb1713836093 Mon Sep 17 00:00:00 2001
|
|
|
191adc |
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
|
|
|
191adc |
Date: Wed, 5 Nov 2014 15:08:03 +0000
|
|
|
191adc |
Subject: [PATCH] Fix bug when there are unset groups prior to (*ACCEPT) within
|
|
|
191adc |
a capturing group.
|
|
|
191adc |
MIME-Version: 1.0
|
|
|
191adc |
Content-Type: text/plain; charset=UTF-8
|
|
|
191adc |
Content-Transfer-Encoding: 8bit
|
|
|
191adc |
|
|
|
191adc |
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1510 2f5784b3-3f2a-0410-8824-cb99058d5e15
|
|
|
191adc |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
191adc |
|
|
|
191adc |
Petr Pisar: Ported to 8.32
|
|
|
191adc |
|
|
|
191adc |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
191adc |
---
|
|
|
191adc |
pcre_exec.c | 13 ++++++++++++-
|
|
|
191adc |
testdata/testinput1 | 3 +++
|
|
|
191adc |
testdata/testoutput1 | 9 +++++++++
|
|
|
191adc |
3 files changed, 24 insertions(+), 1 deletion(-)
|
|
|
191adc |
|
|
|
191adc |
diff --git a/pcre_exec.c b/pcre_exec.c
|
|
|
191adc |
index 478a026..74a2b49 100644
|
|
|
191adc |
--- a/pcre_exec.c
|
|
|
191adc |
+++ b/pcre_exec.c
|
|
|
191adc |
@@ -1539,7 +1539,18 @@ for (;;)
|
|
|
191adc |
md->offset_vector[offset] =
|
|
|
191adc |
md->offset_vector[md->offset_end - number];
|
|
|
191adc |
md->offset_vector[offset+1] = (int)(eptr - md->start_subject);
|
|
|
191adc |
- if (offset_top <= offset) offset_top = offset + 2;
|
|
|
191adc |
+
|
|
|
191adc |
+ /* If this group is at or above the current highwater mark, ensure that
|
|
|
191adc |
+ any groups between the current high water mark and this group are marked
|
|
|
191adc |
+ unset and then update the high water mark. */
|
|
|
191adc |
+
|
|
|
191adc |
+ if (offset >= offset_top)
|
|
|
191adc |
+ {
|
|
|
191adc |
+ register int *iptr = md->offset_vector + offset_top;
|
|
|
191adc |
+ register int *iend = md->offset_vector + offset;
|
|
|
191adc |
+ while (iptr < iend) *iptr++ = -1;
|
|
|
191adc |
+ offset_top = offset + 2;
|
|
|
191adc |
+ }
|
|
|
191adc |
}
|
|
|
191adc |
ecode += 1 + IMM2_SIZE;
|
|
|
191adc |
break;
|
|
|
191adc |
diff --git a/testdata/testinput1 b/testdata/testinput1
|
|
|
191adc |
index c248758..3e1061e 100644
|
|
|
191adc |
--- a/testdata/testinput1
|
|
|
191adc |
+++ b/testdata/testinput1
|
|
|
191adc |
@@ -5318,4 +5318,7 @@ name were given. ---/
|
|
|
191adc |
'\A(?:[^\"]++|\"(?:[^\"]++|\"\")++\")++'
|
|
|
191adc |
NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
|
|
|
191adc |
|
|
|
191adc |
+/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
|
|
|
191adc |
+ 1234abcd
|
|
|
191adc |
+
|
|
|
191adc |
/-- End of testinput1 --/
|
|
|
191adc |
diff --git a/testdata/testoutput1 b/testdata/testoutput1
|
|
|
191adc |
index 9741d1a..5015448 100644
|
|
|
191adc |
--- a/testdata/testoutput1
|
|
|
191adc |
+++ b/testdata/testoutput1
|
|
|
191adc |
@@ -8815,4 +8815,13 @@ No match
|
|
|
191adc |
NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
|
|
|
191adc |
0: NON QUOTED "QUOT""ED" AFTER
|
|
|
191adc |
|
|
|
191adc |
+/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
|
|
|
191adc |
+ 1234abcd
|
|
|
191adc |
+ 0:
|
|
|
191adc |
+ 1: <unset>
|
|
|
191adc |
+ 2: <unset>
|
|
|
191adc |
+ 3: <unset>
|
|
|
191adc |
+ 4: <unset>
|
|
|
191adc |
+ 5:
|
|
|
191adc |
+
|
|
|
191adc |
/-- End of testinput1 --/
|
|
|
191adc |
--
|
|
|
191adc |
2.1.0
|
|
|
191adc |
|