summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2019-07-23 16:58:57 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2019-07-23 16:58:57 +0000
commitfc594b674bafcc3c9b12274bdb4faed9d36853b0 (patch)
tree78bdb3f793d5774e44a1533c96435486b5756fc9
parent37158d060dd5f90980cda777fdf0eeebb7870c50 (diff)
downloadpcre2-fc594b674bafcc3c9b12274bdb4faed9d36853b0.tar.gz
(*ACCEPT) at start of branch was not recording "may match empty string".
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1144 6239d852-aaf2-0410-a92c-79f79f948069
-rw-r--r--ChangeLog3
-rw-r--r--src/pcre2_compile.c5
-rw-r--r--testdata/testoutput22
3 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 67620a8..dea4a87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -110,6 +110,9 @@ within it, the nested lookbehind was not correctly processed. For example, if
(c) An empty string partial hard match can be returned for \z and \Z as it
is documented that they shouldn't match.
+
+22. A branch that started with (*ACCEPT) was not being recognized as one that
+could match an empty string.
Version 10.33 16-April-2019
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index 466f9c7..d5aa1af 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -5302,6 +5302,7 @@ PCRE2_UCHAR *tempcode;
PCRE2_UCHAR *previous = NULL;
PCRE2_UCHAR op_previous;
BOOL groupsetfirstcu = FALSE;
+BOOL had_accept = FALSE;
BOOL matched_char = FALSE;
BOOL previous_matched_char = FALSE;
const uint8_t *cbits = cb->cbits;
@@ -5436,7 +5437,7 @@ for (;; pptr++)
if (meta < META_ASTERISK || meta > META_MINMAX_QUERY)
{
previous = code;
- if (matched_char) okreturn = 1;
+ if (matched_char && !had_accept) okreturn = 1;
}
previous_matched_char = matched_char;
@@ -6075,7 +6076,7 @@ for (;; pptr++)
workspace overflow. Do not set firstcu after *ACCEPT. */
case META_ACCEPT:
- cb->had_accept = TRUE;
+ cb->had_accept = had_accept = TRUE;
for (oc = cb->open_caps;
oc != NULL && oc->assert_depth >= cb->assert_depth;
oc = oc->next)
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 2fcdac6..5fb1d7f 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -11241,6 +11241,7 @@ No match
/(*ACCEPT)a/I,aftertext
Capture group count = 0
+May match empty string
Subject length lower bound = 0
bax
0:
@@ -16911,6 +16912,7 @@ Subject length lower bound = 3
/(*ACCEPT:XX)^abc/I
Capture group count = 0
+May match empty string
Subject length lower bound = 0
/abc/replace=xyz