summaryrefslogtreecommitdiff
path: root/src/pcre2_compile.c
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2019-08-26 16:28:26 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2019-08-26 16:28:26 +0000
commitcb85e500db960f1f9fc122d4dc7bf8a73641a0df (patch)
tree9baf1a980f8fe966bde8ad0f25e118278967b56a /src/pcre2_compile.c
parentd3bc76a63a4a07f4b0f22eb7c4d1e3996d926fa1 (diff)
downloadpcre2-cb85e500db960f1f9fc122d4dc7bf8a73641a0df.tar.gz
Fix bug introduced in commit 1133. Lookbehinds that follow a condition were not
always properly handled. git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1160 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'src/pcre2_compile.c')
-rw-r--r--src/pcre2_compile.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index d5aa1af..1f28a2e 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -9465,14 +9465,14 @@ non-nested closing parenthesis in this case, returning a pointer to it.
Arguments
pptr points to where to start (start of pattern or start of lookahead)
retptr if not NULL, return the ket pointer here
- recurses chain of recurse_check to catch mutual recursion
+ recurses chain of recurse_check to catch mutual recursion
cb points to the compile block
Returns: 0 on success, or an errorcode (cb->erroroffset will be set)
*/
static int
-check_lookbehinds(uint32_t *pptr, uint32_t **retptr,
+check_lookbehinds(uint32_t *pptr, uint32_t **retptr,
parsed_recurse_check *recurses, compile_block *cb)
{
int max;
@@ -9549,13 +9549,22 @@ for (; *pptr != META_END; pptr++)
break;
case META_BACKREF_BYNAME:
+ case META_RECURSE_BYNAME:
+ pptr += 1 + SIZEOFFSET;
+ break;
+
case META_COND_DEFINE:
case META_COND_NAME:
case META_COND_NUMBER:
case META_COND_RNAME:
case META_COND_RNUMBER:
- case META_RECURSE_BYNAME:
pptr += 1 + SIZEOFFSET;
+ nestlevel++;
+ break;
+
+ case META_COND_VERSION:
+ pptr += 3;
+ nestlevel++;
break;
case META_CALLOUT_STRING:
@@ -9576,7 +9585,6 @@ for (; *pptr != META_END; pptr++)
break;
case META_CALLOUT_NUMBER:
- case META_COND_VERSION:
pptr += 3;
break;
@@ -9591,7 +9599,7 @@ for (; *pptr != META_END; pptr++)
case META_LOOKBEHIND:
case META_LOOKBEHINDNOT:
case META_LOOKBEHIND_NA:
- if (!set_lookbehind_lengths(&pptr, &max, &errorcode, &loopcount,
+ if (!set_lookbehind_lengths(&pptr, &max, &errorcode, &loopcount,
recurses, cb))
return errorcode;
break;
@@ -10421,12 +10429,12 @@ if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0)
errorcode = ERR31;
goto HAD_CB_ERROR;
}
-
- /* If study() set a bitmap of starting code units, it implies a minimum
+
+ /* If study() set a bitmap of starting code units, it implies a minimum
length of at least one. */
-
+
if ((re->flags & PCRE2_FIRSTMAPSET) != 0 && minminlength == 0)
- minminlength = 1;
+ minminlength = 1;
/* If the minimum length set (or not set) by study() is less than the minimum
implied by required code units, override it. */