summaryrefslogtreecommitdiff
path: root/src/pcre2_compile.c
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2018-09-02 16:53:29 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2018-09-02 16:53:29 +0000
commitc2d378421fedba48cb02b6b3dc4a74d2a24b2dd4 (patch)
tree61b2af1703fd352618699d167bb48bb94b6c7a9e /src/pcre2_compile.c
parent11ad23b7e6f2b3b81bc7e1e605e34416b5b900ff (diff)
downloadpcre2-c2d378421fedba48cb02b6b3dc4a74d2a24b2dd4.tar.gz
Fix anchoring bug in conditionals with only one branch.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@995 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'src/pcre2_compile.c')
-rw-r--r--src/pcre2_compile.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index f6a7e99..3df55e9 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -1454,8 +1454,8 @@ else if ((i = escapes[c - ESCAPES_FIRST]) != 0)
/* \N{U+ can be handled by the \x{ code. However, this construction is
not valid in EBCDIC environments because it specifies a Unicode
character, not a codepoint in the local code. For example \N{U+0041}
- must be "A" in all environments. Also, in Perl, \N{U+ forces Unicode
- casing semantics for the entire pattern, so allow it only in UTF (i.e.
+ must be "A" in all environments. Also, in Perl, \N{U+ forces Unicode
+ casing semantics for the entire pattern, so allow it only in UTF (i.e.
Unicode) mode. */
if (ptrend - p > 1 && *p == CHAR_U && p[1] == CHAR_PLUS)
@@ -1464,12 +1464,12 @@ else if ((i = escapes[c - ESCAPES_FIRST]) != 0)
*errorcodeptr = ERR93;
#else
if (utf)
- {
+ {
ptr = p + 1;
escape = 0; /* Not a fancy escape after all */
goto COME_FROM_NU;
}
- else *errorcodeptr = ERR93;
+ else *errorcodeptr = ERR93;
#endif
}
@@ -7864,10 +7864,11 @@ do {
if (!is_anchored(scode, bracket_map, cb, atomcount, TRUE)) return FALSE;
}
- /* Condition */
+ /* Condition. If there is no second branch, it can't be anchored. */
else if (op == OP_COND)
{
+ if (scode[GET(scode,1)] != OP_ALT) return FALSE;
if (!is_anchored(scode, bracket_map, cb, atomcount, inassert))
return FALSE;
}