summaryrefslogtreecommitdiff
path: root/usr.sbin/nginx
diff options
context:
space:
mode:
authorRobert Nagy <robert@cvs.openbsd.org>2011-12-14 21:53:39 +0000
committerRobert Nagy <robert@cvs.openbsd.org>2011-12-14 21:53:39 +0000
commit96b58b906df89d84de475989137988cd0678b4ef (patch)
tree9797d0a1802b3adff739094089d2d5ed9a5c3208 /usr.sbin/nginx
parentb00cec847eeeb27d4c754e38b649c07d9972d3d7 (diff)
merge pcre-8.21
Diffstat (limited to 'usr.sbin/nginx')
-rw-r--r--usr.sbin/nginx/src/pcre/pcre.h22
-rw-r--r--usr.sbin/nginx/src/pcre/pcre_compile.c481
-rw-r--r--usr.sbin/nginx/src/pcre/pcre_exec.c687
-rw-r--r--usr.sbin/nginx/src/pcre/pcre_fullinfo.c13
-rw-r--r--usr.sbin/nginx/src/pcre/pcre_internal.h12
-rw-r--r--usr.sbin/nginx/src/pcre/pcre_valid_utf8.c46
6 files changed, 809 insertions, 452 deletions
diff --git a/usr.sbin/nginx/src/pcre/pcre.h b/usr.sbin/nginx/src/pcre/pcre.h
index 42a109a65dc..58ea327e9b2 100644
--- a/usr.sbin/nginx/src/pcre/pcre.h
+++ b/usr.sbin/nginx/src/pcre/pcre.h
@@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */
#define PCRE_MAJOR 8
-#define PCRE_MINOR 20
+#define PCRE_MINOR 21
#define PCRE_PRERELEASE
-#define PCRE_DATE 2011-10-21
+#define PCRE_DATE 2011-12-12
/* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE, the appropriate
@@ -98,20 +98,25 @@ extern "C" {
/* Options. Some are compile-time only, some are run-time only, and some are
both, so we keep them all distinct. However, almost all the bits in the options
word are now used. In the long run, we may have to re-use some of the
-compile-time only bits for runtime options, or vice versa. */
+compile-time only bits for runtime options, or vice versa. In the comments
+below, "compile", "exec", and "DFA exec" mean that the option is permitted to
+be set for those functions; "used in" means that an option may be set only for
+compile, but is subsequently referenced in exec and/or DFA exec. Any of the
+compile-time options may be inspected during studying (and therefore JIT
+compiling). */
#define PCRE_CASELESS 0x00000001 /* Compile */
#define PCRE_MULTILINE 0x00000002 /* Compile */
#define PCRE_DOTALL 0x00000004 /* Compile */
#define PCRE_EXTENDED 0x00000008 /* Compile */
#define PCRE_ANCHORED 0x00000010 /* Compile, exec, DFA exec */
-#define PCRE_DOLLAR_ENDONLY 0x00000020 /* Compile */
+#define PCRE_DOLLAR_ENDONLY 0x00000020 /* Compile, used in exec, DFA exec */
#define PCRE_EXTRA 0x00000040 /* Compile */
#define PCRE_NOTBOL 0x00000080 /* Exec, DFA exec */
#define PCRE_NOTEOL 0x00000100 /* Exec, DFA exec */
#define PCRE_UNGREEDY 0x00000200 /* Compile */
#define PCRE_NOTEMPTY 0x00000400 /* Exec, DFA exec */
-#define PCRE_UTF8 0x00000800 /* Compile */
+#define PCRE_UTF8 0x00000800 /* Compile, used in exec, DFA exec */
#define PCRE_NO_AUTO_CAPTURE 0x00001000 /* Compile */
#define PCRE_NO_UTF8_CHECK 0x00002000 /* Compile, exec, DFA exec */
#define PCRE_AUTO_CALLOUT 0x00004000 /* Compile */
@@ -119,7 +124,7 @@ compile-time only bits for runtime options, or vice versa. */
#define PCRE_PARTIAL 0x00008000 /* Backwards compatible synonym */
#define PCRE_DFA_SHORTEST 0x00010000 /* DFA exec */
#define PCRE_DFA_RESTART 0x00020000 /* DFA exec */
-#define PCRE_FIRSTLINE 0x00040000 /* Compile */
+#define PCRE_FIRSTLINE 0x00040000 /* Compile, used in exec, DFA exec */
#define PCRE_DUPNAMES 0x00080000 /* Compile */
#define PCRE_NEWLINE_CR 0x00100000 /* Compile, exec, DFA exec */
#define PCRE_NEWLINE_LF 0x00200000 /* Compile, exec, DFA exec */
@@ -128,12 +133,12 @@ compile-time only bits for runtime options, or vice versa. */
#define PCRE_NEWLINE_ANYCRLF 0x00500000 /* Compile, exec, DFA exec */
#define PCRE_BSR_ANYCRLF 0x00800000 /* Compile, exec, DFA exec */
#define PCRE_BSR_UNICODE 0x01000000 /* Compile, exec, DFA exec */
-#define PCRE_JAVASCRIPT_COMPAT 0x02000000 /* Compile */
+#define PCRE_JAVASCRIPT_COMPAT 0x02000000 /* Compile, used in exec */
#define PCRE_NO_START_OPTIMIZE 0x04000000 /* Compile, exec, DFA exec */
#define PCRE_NO_START_OPTIMISE 0x04000000 /* Synonym */
#define PCRE_PARTIAL_HARD 0x08000000 /* Exec, DFA exec */
#define PCRE_NOTEMPTY_ATSTART 0x10000000 /* Exec, DFA exec */
-#define PCRE_UCP 0x20000000 /* Compile */
+#define PCRE_UCP 0x20000000 /* Compile, used in exec, DFA exec */
/* Exec-time and get/set-time error codes */
@@ -211,6 +216,7 @@ compile-time only bits for runtime options, or vice versa. */
#define PCRE_INFO_HASCRORLF 14
#define PCRE_INFO_MINLENGTH 15
#define PCRE_INFO_JIT 16
+#define PCRE_INFO_JITSIZE 17
/* Request types for pcre_config(). Do not re-arrange, in order to remain
compatible. */
diff --git a/usr.sbin/nginx/src/pcre/pcre_compile.c b/usr.sbin/nginx/src/pcre/pcre_compile.c
index 4f2a9ece171..d3da5f62109 100644
--- a/usr.sbin/nginx/src/pcre/pcre_compile.c
+++ b/usr.sbin/nginx/src/pcre/pcre_compile.c
@@ -88,14 +88,21 @@ so this number is very generous.
The same workspace is used during the second, actual compile phase for
remembering forward references to groups so that they can be filled in at the
end. Each entry in this list occupies LINK_SIZE bytes, so even when LINK_SIZE
-is 4 there is plenty of room. */
+is 4 there is plenty of room for most patterns. However, the memory can get
+filled up by repetitions of forward references, for example patterns like
+/(?1){0,1999}(b)/, and one user did hit the limit. The code has been changed so
+that the workspace is expanded using malloc() in this situation. The value
+below is therefore a minimum, and we put a maximum on it for safety. The
+minimum is now also defined in terms of LINK_SIZE so that the use of malloc()
+kicks in at the same number of forward references in all cases. */
-#define COMPILE_WORK_SIZE (4096)
+#define COMPILE_WORK_SIZE (2048*LINK_SIZE)
+#define COMPILE_WORK_SIZE_MAX (100*COMPILE_WORK_SIZE)
/* The overrun tests check for a slightly smaller size so that they detect the
overrun before it actually does run off the end of the data block. */
-#define WORK_SIZE_CHECK (COMPILE_WORK_SIZE - 100)
+#define WORK_SIZE_SAFETY_MARGIN (100)
/* Table for handling escaped characters in the range '0'-'z'. Positive returns
@@ -410,6 +417,10 @@ static const char error_texts[] =
"this version of PCRE is not compiled with PCRE_UCP support\0"
"\\c must be followed by an ASCII character\0"
"\\k is not followed by a braced, angle-bracketed, or quoted name\0"
+ /* 70 */
+ "internal error: unknown opcode in find_fixedlength()\0"
+ "\\N is not supported in a class\0"
+ "too many forward references\0"
;
/* Table to identify digits and hex digits. This is used when compiling
@@ -578,6 +589,44 @@ return s;
/*************************************************
+* Expand the workspace *
+*************************************************/
+
+/* This function is called during the second compiling phase, if the number of
+forward references fills the existing workspace, which is originally a block on
+the stack. A larger block is obtained from malloc() unless the ultimate limit
+has been reached or the increase will be rather small.
+
+Argument: pointer to the compile data block
+Returns: 0 if all went well, else an error number
+*/
+
+static int
+expand_workspace(compile_data *cd)
+{
+uschar *newspace;
+int newsize = cd->workspace_size * 2;
+
+if (newsize > COMPILE_WORK_SIZE_MAX) newsize = COMPILE_WORK_SIZE_MAX;
+if (cd->workspace_size >= COMPILE_WORK_SIZE_MAX ||
+ newsize - cd->workspace_size < WORK_SIZE_SAFETY_MARGIN)
+ return ERR72;
+
+newspace = (pcre_malloc)(newsize);
+if (newspace == NULL) return ERR21;
+
+memcpy(newspace, cd->start_workspace, cd->workspace_size);
+cd->hwm = (uschar *)newspace + (cd->hwm - cd->start_workspace);
+if (cd->workspace_size > COMPILE_WORK_SIZE)
+ (pcre_free)((void *)cd->start_workspace);
+cd->start_workspace = newspace;
+cd->workspace_size = newsize;
+return 0;
+}
+
+
+
+/*************************************************
* Check for counted repeat *
*************************************************/
@@ -676,9 +725,38 @@ else
case CHAR_l:
case CHAR_L:
+ *errorcodeptr = ERR37;
+ break;
+
case CHAR_u:
+ if ((options & PCRE_JAVASCRIPT_COMPAT) != 0)
+ {
+ /* In JavaScript, \u must be followed by four hexadecimal numbers.
+ Otherwise it is a lowercase u letter. */
+ if ((digitab[ptr[1]] & ctype_xdigit) != 0 && (digitab[ptr[2]] & ctype_xdigit) != 0
+ && (digitab[ptr[3]] & ctype_xdigit) != 0 && (digitab[ptr[4]] & ctype_xdigit) != 0)
+ {
+ c = 0;
+ for (i = 0; i < 4; ++i)
+ {
+ register int cc = *(++ptr);
+#ifndef EBCDIC /* ASCII/UTF-8 coding */
+ if (cc >= CHAR_a) cc -= 32; /* Convert to upper case */
+ c = (c << 4) + cc - ((cc < CHAR_A)? CHAR_0 : (CHAR_A - 10));
+#else /* EBCDIC coding */
+ if (cc >= CHAR_a && cc <= CHAR_z) cc += 64; /* Convert to upper case */
+ c = (c << 4) + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));
+#endif
+ }
+ }
+ }
+ else
+ *errorcodeptr = ERR37;
+ break;
+
case CHAR_U:
- *errorcodeptr = ERR37;
+ /* In JavaScript, \U is an uppercase U letter. */
+ if ((options & PCRE_JAVASCRIPT_COMPAT) == 0) *errorcodeptr = ERR37;
break;
/* In a character class, \g is just a literal "g". Outside a character
@@ -828,6 +906,28 @@ else
treated as a data character. */
case CHAR_x:
+ if ((options & PCRE_JAVASCRIPT_COMPAT) != 0)
+ {
+ /* In JavaScript, \x must be followed by two hexadecimal numbers.
+ Otherwise it is a lowercase x letter. */
+ if ((digitab[ptr[1]] & ctype_xdigit) != 0 && (digitab[ptr[2]] & ctype_xdigit) != 0)
+ {
+ c = 0;
+ for (i = 0; i < 2; ++i)
+ {
+ register int cc = *(++ptr);
+#ifndef EBCDIC /* ASCII/UTF-8 coding */
+ if (cc >= CHAR_a) cc -= 32; /* Convert to upper case */
+ c = (c << 4) + cc - ((cc < CHAR_A)? CHAR_0 : (CHAR_A - 10));
+#else /* EBCDIC coding */
+ if (cc >= CHAR_a && cc <= CHAR_z) cc += 64; /* Convert to upper case */
+ c = (c << 4) + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));
+#endif
+ }
+ }
+ break;
+ }
+
if (ptr[1] == CHAR_LEFT_CURLY_BRACKET)
{
const uschar *pt = ptr + 2;
@@ -1475,8 +1575,9 @@ Arguments:
Returns: the fixed length,
or -1 if there is no fixed length,
- or -2 if \C was encountered
+ or -2 if \C was encountered (in UTF-8 mode only)
or -3 if an OP_RECURSE item was encountered and atend is FALSE
+ or -4 if an unknown opcode was encountered (internal error)
*/
static int
@@ -1500,8 +1601,7 @@ for (;;)
/* We only need to continue for OP_CBRA (normal capturing bracket) and
OP_BRA (normal non-capturing bracket) because the other variants of these
opcodes are all concerned with unlimited repeated groups, which of course
- are not of fixed length. They will cause a -1 response from the default
- case of this switch. */
+ are not of fixed length. */
case OP_CBRA:
case OP_BRA:
@@ -1515,15 +1615,17 @@ for (;;)
cc += 1 + LINK_SIZE;
break;
- /* Reached end of a branch; if it's a ket it is the end of a nested
- call. If it's ALT it is an alternation in a nested call. If it is
- END it's the end of the outer call. All can be handled by the same code.
- Note that we must not include the OP_KETRxxx opcodes here, because they
- all imply an unlimited repeat. */
+ /* Reached end of a branch; if it's a ket it is the end of a nested call.
+ If it's ALT it is an alternation in a nested call. An ACCEPT is effectively
+ an ALT. If it is END it's the end of the outer call. All can be handled by
+ the same code. Note that we must not include the OP_KETRxxx opcodes here,
+ because they all imply an unlimited repeat. */
case OP_ALT:
case OP_KET:
case OP_END:
+ case OP_ACCEPT:
+ case OP_ASSERT_ACCEPT:
if (length < 0) length = branchlength;
else if (length != branchlength) return -1;
if (*cc != OP_ALT) return length;
@@ -1557,23 +1659,36 @@ for (;;)
/* Skip over things that don't match chars */
- case OP_REVERSE:
- case OP_CREF:
- case OP_NCREF:
- case OP_RREF:
- case OP_NRREF:
- case OP_DEF:
+ case OP_MARK:
+ case OP_PRUNE_ARG:
+ case OP_SKIP_ARG:
+ case OP_THEN_ARG:
+ cc += cc[1] + _pcre_OP_lengths[*cc];
+ break;
+
case OP_CALLOUT:
- case OP_SOD:
- case OP_SOM:
- case OP_SET_SOM:
- case OP_EOD:
- case OP_EODN:
case OP_CIRC:
case OP_CIRCM:
+ case OP_CLOSE:
+ case OP_COMMIT:
+ case OP_CREF:
+ case OP_DEF:
case OP_DOLL:
case OP_DOLLM:
+ case OP_EOD:
+ case OP_EODN:
+ case OP_FAIL:
+ case OP_NCREF:
+ case OP_NRREF:
case OP_NOT_WORD_BOUNDARY:
+ case OP_PRUNE:
+ case OP_REVERSE:
+ case OP_RREF:
+ case OP_SET_SOM:
+ case OP_SKIP:
+ case OP_SOD:
+ case OP_SOM:
+ case OP_THEN:
case OP_WORD_BOUNDARY:
cc += _pcre_OP_lengths[*cc];
break;
@@ -1595,6 +1710,9 @@ for (;;)
need to skip over a multibyte character in UTF8 mode. */
case OP_EXACT:
+ case OP_EXACTI:
+ case OP_NOTEXACT:
+ case OP_NOTEXACTI:
branchlength += GET2(cc,1);
cc += 4;
#ifdef SUPPORT_UTF8
@@ -1615,6 +1733,10 @@ for (;;)
cc += 2;
/* Fall through */
+ case OP_HSPACE:
+ case OP_VSPACE:
+ case OP_NOT_HSPACE:
+ case OP_NOT_VSPACE:
case OP_NOT_DIGIT:
case OP_DIGIT:
case OP_NOT_WHITESPACE:
@@ -1627,7 +1749,8 @@ for (;;)
cc++;
break;
- /* The single-byte matcher isn't allowed */
+ /* The single-byte matcher isn't allowed. This only happens in UTF-8 mode;
+ otherwise \C is coded as OP_ALLANY. */
case OP_ANYBYTE:
return -2;
@@ -1646,6 +1769,8 @@ for (;;)
switch (*cc)
{
+ case OP_CRPLUS:
+ case OP_CRMINPLUS:
case OP_CRSTAR:
case OP_CRMINSTAR:
case OP_CRQUERY:
@@ -1666,8 +1791,91 @@ for (;;)
/* Anything else is variable length */
- default:
+ case OP_ANYNL:
+ case OP_BRAMINZERO:
+ case OP_BRAPOS:
+ case OP_BRAPOSZERO:
+ case OP_BRAZERO:
+ case OP_CBRAPOS:
+ case OP_EXTUNI:
+ case OP_KETRMAX:
+ case OP_KETRMIN:
+ case OP_KETRPOS:
+ case OP_MINPLUS:
+ case OP_MINPLUSI:
+ case OP_MINQUERY:
+ case OP_MINQUERYI:
+ case OP_MINSTAR:
+ case OP_MINSTARI:
+ case OP_MINUPTO:
+ case OP_MINUPTOI:
+ case OP_NOTMINPLUS:
+ case OP_NOTMINPLUSI:
+ case OP_NOTMINQUERY:
+ case OP_NOTMINQUERYI:
+ case OP_NOTMINSTAR:
+ case OP_NOTMINSTARI:
+ case OP_NOTMINUPTO:
+ case OP_NOTMINUPTOI:
+ case OP_NOTPLUS:
+ case OP_NOTPLUSI:
+ case OP_NOTPOSPLUS:
+ case OP_NOTPOSPLUSI:
+ case OP_NOTPOSQUERY:
+ case OP_NOTPOSQUERYI:
+ case OP_NOTPOSSTAR:
+ case OP_NOTPOSSTARI:
+ case OP_NOTPOSUPTO:
+ case OP_NOTPOSUPTOI:
+ case OP_NOTQUERY:
+ case OP_NOTQUERYI:
+ case OP_NOTSTAR:
+ case OP_NOTSTARI:
+ case OP_NOTUPTO:
+ case OP_NOTUPTOI:
+ case OP_PLUS:
+ case OP_PLUSI:
+ case OP_POSPLUS:
+ case OP_POSPLUSI:
+ case OP_POSQUERY:
+ case OP_POSQUERYI:
+ case OP_POSSTAR:
+ case OP_POSSTARI:
+ case OP_POSUPTO:
+ case OP_POSUPTOI:
+ case OP_QUERY:
+ case OP_QUERYI:
+ case OP_REF:
+ case OP_REFI:
+ case OP_SBRA:
+ case OP_SBRAPOS:
+ case OP_SCBRA:
+ case OP_SCBRAPOS:
+ case OP_SCOND:
+ case OP_SKIPZERO:
+ case OP_STAR:
+ case OP_STARI:
+ case OP_TYPEMINPLUS:
+ case OP_TYPEMINQUERY:
+ case OP_TYPEMINSTAR:
+ case OP_TYPEMINUPTO:
+ case OP_TYPEPLUS:
+ case OP_TYPEPOSPLUS:
+ case OP_TYPEPOSQUERY:
+ case OP_TYPEPOSSTAR:
+ case OP_TYPEPOSUPTO:
+ case OP_TYPEQUERY:
+ case OP_TYPESTAR:
+ case OP_TYPEUPTO:
+ case OP_UPTO:
+ case OP_UPTOI:
return -1;
+
+ /* Catch unrecognized opcodes so that when new ones are added they
+ are not forgotten, as has happened in the past. */
+
+ default:
+ return -4;
}
}
/* Control never gets here */
@@ -3169,7 +3377,8 @@ for (;; ptr++)
#ifdef PCRE_DEBUG
if (code > cd->hwm) cd->hwm = code; /* High water info */
#endif
- if (code > cd->start_workspace + WORK_SIZE_CHECK) /* Check for overrun */
+ if (code > cd->start_workspace + cd->workspace_size -
+ WORK_SIZE_SAFETY_MARGIN) /* Check for overrun */
{
*errorcodeptr = ERR52;
goto FAILED;
@@ -3192,7 +3401,8 @@ for (;; ptr++)
}
*lengthptr += (int)(code - last_code);
- DPRINTF(("length=%d added %d c=%c\n", *lengthptr, code - last_code, c));
+ DPRINTF(("length=%d added %d c=%c\n", *lengthptr, (int)(code - last_code),
+ c));
/* If "previous" is set and it is not at the start of the work space, move
it back to there, in order to avoid filling up the work space. Otherwise,
@@ -3218,7 +3428,8 @@ for (;; ptr++)
/* In the real compile phase, just check the workspace used by the forward
reference list. */
- else if (cd->hwm > cd->start_workspace + WORK_SIZE_CHECK)
+ else if (cd->hwm > cd->start_workspace + cd->workspace_size -
+ WORK_SIZE_SAFETY_MARGIN)
{
*errorcodeptr = ERR52;
goto FAILED;
@@ -3472,7 +3683,7 @@ for (;; ptr++)
if (lengthptr != NULL)
{
- *lengthptr += class_utf8data - class_utf8data_base;
+ *lengthptr += (int)(class_utf8data - class_utf8data_base);
class_utf8data = class_utf8data_base;
}
@@ -3608,6 +3819,11 @@ for (;; ptr++)
if (*errorcodeptr != 0) goto FAILED;
if (-c == ESC_b) c = CHAR_BS; /* \b is backspace in a class */
+ else if (-c == ESC_N) /* \N is not supported in a class */
+ {
+ *errorcodeptr = ERR71;
+ goto FAILED;
+ }
else if (-c == ESC_Q) /* Handle start of quoted string */
{
if (ptr[1] == CHAR_BACKSLASH && ptr[2] == CHAR_E)
@@ -4033,7 +4249,7 @@ for (;; ptr++)
if ((options & PCRE_CASELESS) != 0)
{
unsigned int othercase;
- if ((othercase = UCD_OTHERCASE(c)) != (unsigned int)c)
+ if ((othercase = UCD_OTHERCASE(c)) != (unsigned int)c)
{
*class_utf8data++ = XCL_SINGLE;
class_utf8data += _pcre_ord2utf8(othercase, class_utf8data);
@@ -4166,7 +4382,7 @@ for (;; ptr++)
/* Now fill in the complete length of the item */
- PUT(previous, 1, code - previous);
+ PUT(previous, 1, (int)(code - previous));
break; /* End of class handling */
}
#endif
@@ -4308,7 +4524,7 @@ for (;; ptr++)
{
uschar *lastchar = code - 1;
while((*lastchar & 0xc0) == 0x80) lastchar--;
- c = code - lastchar; /* Length of UTF-8 character */
+ c = (int)(code - lastchar); /* Length of UTF-8 character */
memcpy(utf8_char, lastchar, c); /* Save the char */
c |= 0x80; /* Flag c as a length */
}
@@ -4715,16 +4931,32 @@ for (;; ptr++)
*lengthptr += delta;
}
- /* This is compiling for real */
+ /* This is compiling for real. If there is a set first byte for
+ the group, and we have not yet set a "required byte", set it. Make
+ sure there is enough workspace for copying forward references before
+ doing the copy. */
else
{
if (groupsetfirstbyte && reqbyte < 0) reqbyte = firstbyte;
+
for (i = 1; i < repeat_min; i++)
{
uschar *hc;
uschar *this_hwm = cd->hwm;
memcpy(code, previous, len);
+
+ while (cd->hwm > cd->start_workspace + cd->workspace_size -
+ WORK_SIZE_SAFETY_MARGIN - (this_hwm - save_hwm))
+ {
+ int save_offset = save_hwm - cd->start_workspace;
+ int this_offset = this_hwm - cd->start_workspace;
+ *errorcodeptr = expand_workspace(cd);
+ if (*errorcodeptr != 0) goto FAILED;
+ save_hwm = (uschar *)cd->start_workspace + save_offset;
+ this_hwm = (uschar *)cd->start_workspace + this_offset;
+ }
+
for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE)
{
PUT(cd->hwm, 0, GET(hc, 0) + len);
@@ -4792,6 +5024,21 @@ for (;; ptr++)
}
memcpy(code, previous, len);
+
+ /* Ensure there is enough workspace for forward references before
+ copying them. */
+
+ while (cd->hwm > cd->start_workspace + cd->workspace_size -
+ WORK_SIZE_SAFETY_MARGIN - (this_hwm - save_hwm))
+ {
+ int save_offset = save_hwm - cd->start_workspace;
+ int this_offset = this_hwm - cd->start_workspace;
+ *errorcodeptr = expand_workspace(cd);
+ if (*errorcodeptr != 0) goto FAILED;
+ save_hwm = (uschar *)cd->start_workspace + save_offset;
+ this_hwm = (uschar *)cd->start_workspace + this_offset;
+ }
+
for (hc = save_hwm; hc < this_hwm; hc += LINK_SIZE)
{
PUT(cd->hwm, 0, GET(hc, 0) + len + ((i != 0)? 2+LINK_SIZE : 1));
@@ -4823,41 +5070,47 @@ for (;; ptr++)
behaviour of (?:xx)++ is the same as (?>xx)++ and this saves having to
deal with possessive ONCEs specially.
- Otherwise, if the quantifier was possessive, we convert the BRA code to
- the POS form, and the KET code to KETRPOS. (It turns out to be convenient
- at runtime to detect this kind of subpattern at both the start and at the
- end.) The use of special opcodes makes it possible to reduce greatly the
- stack usage in pcre_exec(). If the group is preceded by OP_BRAZERO,
- convert this to OP_BRAPOSZERO. Then cancel the possessive flag so that
- the default action below, of wrapping everything inside atomic brackets,
- does not happen.
-
- Then, when we are doing the actual compile phase, check to see whether
- this group is one that could match an empty string. If so, convert the
- initial operator to the S form (e.g. OP_BRA -> OP_SBRA) so that runtime
- checking can be done. [This check is also applied to ONCE groups at
- runtime, but in a different way.] */
+ Otherwise, when we are doing the actual compile phase, check to see
+ whether this group is one that could match an empty string. If so,
+ convert the initial operator to the S form (e.g. OP_BRA -> OP_SBRA) so
+ that runtime checking can be done. [This check is also applied to ONCE
+ groups at runtime, but in a different way.]
+
+ Then, if the quantifier was possessive and the bracket is not a
+ conditional, we convert the BRA code to the POS form, and the KET code to
+ KETRPOS. (It turns out to be convenient at runtime to detect this kind of
+ subpattern at both the start and at the end.) The use of special opcodes
+ makes it possible to reduce greatly the stack usage in pcre_exec(). If
+ the group is preceded by OP_BRAZERO, convert this to OP_BRAPOSZERO.
+
+ Then, if the minimum number of matches is 1 or 0, cancel the possessive
+ flag so that the default action below, of wrapping everything inside
+ atomic brackets, does not happen. When the minimum is greater than 1,
+ there will be earlier copies of the group, and so we still have to wrap
+ the whole thing. */
else
{
uschar *ketcode = code - 1 - LINK_SIZE;
uschar *bracode = ketcode - GET(ketcode, 1);
+ /* Convert possessive ONCE brackets to non-capturing */
+
if ((*bracode == OP_ONCE || *bracode == OP_ONCE_NC) &&
possessive_quantifier) *bracode = OP_BRA;
+ /* For non-possessive ONCE brackets, all we need to do is to
+ set the KET. */
+
if (*bracode == OP_ONCE || *bracode == OP_ONCE_NC)
*ketcode = OP_KETRMAX + repeat_type;
+
+ /* Handle non-ONCE brackets and possessive ONCEs (which have been
+ converted to non-capturing above). */
+
else
{
- if (possessive_quantifier)
- {
- *bracode += 1; /* Switch to xxxPOS opcodes */
- *ketcode = OP_KETRPOS;
- if (brazeroptr != NULL) *brazeroptr = OP_BRAPOSZERO;
- possessive_quantifier = FALSE;
- }
- else *ketcode = OP_KETRMAX + repeat_type;
+ /* In the compile phase, check for empty string matching. */
if (lengthptr == NULL)
{
@@ -4873,6 +5126,48 @@ for (;; ptr++)
}
while (*scode == OP_ALT);
}
+
+ /* Handle possessive quantifiers. */
+
+ if (possessive_quantifier)
+ {
+ /* For COND brackets, we wrap the whole thing in a possessively
+ repeated non-capturing bracket, because we have not invented POS
+ versions of the COND opcodes. Because we are moving code along, we
+ must ensure that any pending recursive references are updated. */
+
+ if (*bracode == OP_COND || *bracode == OP_SCOND)
+ {
+ int nlen = (int)(code - bracode);
+ *code = OP_END;
+ adjust_recurse(bracode, 1 + LINK_SIZE, utf8, cd, save_hwm);
+ memmove(bracode + 1+LINK_SIZE, bracode, nlen);
+ code += 1 + LINK_SIZE;
+ nlen += 1 + LINK_SIZE;
+ *bracode = OP_BRAPOS;
+ *code++ = OP_KETRPOS;
+ PUTINC(code, 0, nlen);
+ PUT(bracode, 1, nlen);
+ }
+
+ /* For non-COND brackets, we modify the BRA code and use KETRPOS. */
+
+ else
+ {
+ *bracode += 1; /* Switch to xxxPOS opcodes */
+ *ketcode = OP_KETRPOS;
+ }
+
+ /* If the minimum is zero, mark it as possessive, then unset the
+ possessive flag when the minimum is 0 or 1. */
+
+ if (brazeroptr != NULL) *brazeroptr = OP_BRAPOSZERO;
+ if (repeat_min < 2) possessive_quantifier = FALSE;
+ }
+
+ /* Non-possessive quantifier */
+
+ else *ketcode = OP_KETRMAX + repeat_type;
}
}
}
@@ -4899,9 +5194,9 @@ for (;; ptr++)
notation is just syntactic sugar, taken from Sun's Java package, but the
special opcodes can optimize it.
- Possessively repeated subpatterns have already been handled in the code
- just above, so possessive_quantifier is always FALSE for them at this
- stage.
+ Some (but not all) possessively repeated subpatterns have already been
+ completely handled in the code just above. For them, possessive_quantifier
+ is always FALSE at this stage.
Note that the repeated item starts at tempcode, not at previous, which
might be the first part of a string whose (former) last char we repeated.
@@ -5391,8 +5686,8 @@ for (;; ptr++)
/* ------------------------------------------------------------ */
case CHAR_C: /* Callout - may be followed by digits; */
- previous_callout = code; /* Save for later completion */
- after_manual_callout = 1; /* Skip one item before completing */
+ previous_callout = code; /* Save for later completion */
+ after_manual_callout = 1; /* Skip one item before completing */
*code++ = OP_CALLOUT;
{
int n = 0;
@@ -5763,6 +6058,12 @@ for (;; ptr++)
of the group. Then remember the forward reference. */
called = cd->start_code + recno;
+ if (cd->hwm >= cd->start_workspace + cd->workspace_size -
+ WORK_SIZE_SAFETY_MARGIN)
+ {
+ *errorcodeptr = expand_workspace(cd);
+ if (*errorcodeptr != 0) goto FAILED;
+ }
PUTINC(cd->hwm, 0, (int)(code + 1 - cd->start_code));
}
@@ -5783,11 +6084,14 @@ for (;; ptr++)
}
}
- /* Insert the recursion/subroutine item. */
+ /* Insert the recursion/subroutine item. It does not have a set first
+ byte (relevant if it is repeated, because it will then be wrapped
+ with ONCE brackets). */
*code = OP_RECURSE;
PUT(code, 1, (int)(called - cd->start_code));
code += 1 + LINK_SIZE;
+ groupsetfirstbyte = FALSE;
}
/* Can't determine a first byte now */
@@ -6269,9 +6573,12 @@ for (;; ptr++)
}
else
#endif
+ /* In non-UTF-8 mode, we turn \C into OP_ALLANY instead of OP_ANYBYTE
+ so that it works in DFA mode and in lookbehinds. */
+
{
previous = (-c > ESC_b && -c < ESC_Z)? code : NULL;
- *code++ = -c;
+ *code++ = (!utf8 && c == -ESC_C)? OP_ALLANY : -c;
}
}
continue;
@@ -6563,7 +6870,8 @@ for (;;)
}
else if (fixed_length < 0)
{
- *errorcodeptr = (fixed_length == -2)? ERR36 : ERR25;
+ *errorcodeptr = (fixed_length == -2)? ERR36 :
+ (fixed_length == -4)? ERR70: ERR25;
*ptrptr = ptr;
return FALSE;
}
@@ -7006,7 +7314,8 @@ compile_data *cd = &compile_block;
computing the amount of memory that is needed. Compiled items are thrown away
as soon as possible, so that a fairly large buffer should be sufficient for
this purpose. The same space is used in the second phase for remembering where
-to fill in forward references to subpatterns. */
+to fill in forward references to subpatterns. That may overflow, in which case
+new memory is obtained from malloc(). */
uschar cworkspace[COMPILE_WORK_SIZE];
@@ -7196,9 +7505,10 @@ cd->bracount = cd->final_bracount = 0;
cd->names_found = 0;
cd->name_entry_size = 0;
cd->name_table = NULL;
-cd->start_workspace = cworkspace;
cd->start_code = cworkspace;
cd->hwm = cworkspace;
+cd->start_workspace = cworkspace;
+cd->workspace_size = COMPILE_WORK_SIZE;
cd->start_pattern = (const uschar *)pattern;
cd->end_pattern = (const uschar *)(pattern + strlen(pattern));
cd->req_varyopt = 0;
@@ -7233,7 +7543,7 @@ externally provided function. Integer overflow should no longer be possible
because nowadays we limit the maximum value of cd->names_found and
cd->name_entry_size. */
-size = length + sizeof(real_pcre) + cd->names_found * (cd->name_entry_size + 3);
+size = length + sizeof(real_pcre) + cd->names_found * cd->name_entry_size;
re = (real_pcre *)(pcre_malloc)(size);
if (re == NULL)
@@ -7276,7 +7586,7 @@ cd->names_found = 0;
cd->name_table = (uschar *)re + re->name_table_offset;
codestart = cd->name_table + re->name_entry_size * re->name_count;
cd->start_code = codestart;
-cd->hwm = cworkspace;
+cd->hwm = (uschar *)(cd->start_workspace);
cd->req_varyopt = 0;
cd->had_accept = FALSE;
cd->check_lookbehind = FALSE;
@@ -7310,20 +7620,34 @@ if debugging, leave the test till after things are printed out. */
if (code - codestart > length) errorcode = ERR23;
#endif
-/* Fill in any forward references that are required. */
+/* Fill in any forward references that are required. There may be repeated
+references; optimize for them, as searching a large regex takes time. */
-while (errorcode == 0 && cd->hwm > cworkspace)
+if (cd->hwm > cd->start_workspace)
{
- int offset, recno;
- const uschar *groupptr;
- cd->hwm -= LINK_SIZE;
- offset = GET(cd->hwm, 0);
- recno = GET(codestart, offset);
- groupptr = _pcre_find_bracket(codestart, utf8, recno);
- if (groupptr == NULL) errorcode = ERR53;
- else PUT(((uschar *)codestart), offset, (int)(groupptr - codestart));
+ int prev_recno = -1;
+ const uschar *groupptr = NULL;
+ while (errorcode == 0 && cd->hwm > cd->start_workspace)
+ {
+ int offset, recno;
+ cd->hwm -= LINK_SIZE;
+ offset = GET(cd->hwm, 0);
+ recno = GET(codestart, offset);
+ if (recno != prev_recno)
+ {
+ groupptr = _pcre_find_bracket(codestart, utf8, recno);
+ prev_recno = recno;
+ }
+ if (groupptr == NULL) errorcode = ERR53;
+ else PUT(((uschar *)codestart), offset, (int)(groupptr - codestart));
+ }
}
+/* If the workspace had to be expanded, free the new memory. */
+
+if (cd->workspace_size > COMPILE_WORK_SIZE)
+ (pcre_free)((void *)cd->start_workspace);
+
/* Give an error if there's back reference to a non-existent capturing
subpattern. */
@@ -7362,7 +7686,8 @@ if (cd->check_lookbehind)
DPRINTF(("fixed length = %d\n", fixed_length));
if (fixed_length < 0)
{
- errorcode = (fixed_length == -2)? ERR36 : ERR25;
+ errorcode = (fixed_length == -2)? ERR36 :
+ (fixed_length == -4)? ERR70 : ERR25;
break;
}
PUT(cc, 1, fixed_length);
diff --git a/usr.sbin/nginx/src/pcre/pcre_exec.c b/usr.sbin/nginx/src/pcre/pcre_exec.c
index d390ff422b1..46498d590cf 100644
--- a/usr.sbin/nginx/src/pcre/pcre_exec.c
+++ b/usr.sbin/nginx/src/pcre/pcre_exec.c
@@ -82,14 +82,6 @@ negative to avoid the external error codes. */
#define MATCH_SKIP_ARG (-993)
#define MATCH_THEN (-992)
-/* This is a convenience macro for code that occurs many times. */
-
-#define MRRETURN(ra) \
- { \
- md->mark = markptr; \
- RRETURN(ra); \
- }
-
/* Maximum number of ints of offset to save on the stack for recursive calls.
If the offset vector is bigger, malloc is used. This should be a multiple of 3,
because the offset vector is always a multiple of 3 long. */
@@ -225,7 +217,7 @@ else
while (length-- > 0) if (*p++ != *eptr++) return -1;
}
-return eptr - eptr_start;
+return (int)(eptr - eptr_start);
}
@@ -290,7 +282,7 @@ actually used in this definition. */
#define RMATCH(ra,rb,rc,rd,re,rw) \
{ \
printf("match() called in line %d\n", __LINE__); \
- rrc = match(ra,rb,mstart,markptr,rc,rd,re,rdepth+1); \
+ rrc = match(ra,rb,mstart,rc,rd,re,rdepth+1); \
printf("to line %d\n", __LINE__); \
}
#define RRETURN(ra) \
@@ -300,7 +292,7 @@ actually used in this definition. */
}
#else
#define RMATCH(ra,rb,rc,rd,re,rw) \
- rrc = match(ra,rb,mstart,markptr,rc,rd,re,rdepth+1)
+ rrc = match(ra,rb,mstart,rc,rd,re,rdepth+1)
#define RRETURN(ra) return ra
#endif
@@ -321,7 +313,6 @@ argument of match(), which never changes. */
newframe->Xeptr = ra;\
newframe->Xecode = rb;\
newframe->Xmstart = mstart;\
- newframe->Xmarkptr = markptr;\
newframe->Xoffset_top = rc;\
newframe->Xeptrb = re;\
newframe->Xrdepth = frame->Xrdepth + 1;\
@@ -357,7 +348,6 @@ typedef struct heapframe {
USPTR Xeptr;
const uschar *Xecode;
USPTR Xmstart;
- USPTR Xmarkptr;
int Xoffset_top;
eptrblock *Xeptrb;
unsigned int Xrdepth;
@@ -427,7 +417,7 @@ returns a negative (error) response, the outer incarnation must also return the
same response. */
/* These macros pack up tests that are used for partial matching, and which
-appears several times in the code. We set the "hit end" flag if the pointer is
+appear several times in the code. We set the "hit end" flag if the pointer is
at the end of the subject and also past the start of the subject (i.e.
something has been matched). For hard partial matching, we then return
immediately. The second one is used when we already know we are past the end of
@@ -438,14 +428,14 @@ the subject. */
eptr > md->start_used_ptr) \
{ \
md->hitend = TRUE; \
- if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL); \
+ if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL); \
}
#define SCHECK_PARTIAL()\
if (md->partial != 0 && eptr > md->start_used_ptr) \
{ \
md->hitend = TRUE; \
- if (md->partial > 1) MRRETURN(PCRE_ERROR_PARTIAL); \
+ if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL); \
}
@@ -459,7 +449,6 @@ Arguments:
ecode pointer to current position in compiled code
mstart pointer to the current match start position (can be modified
by encountering \K)
- markptr pointer to the most recent MARK name, or NULL
offset_top current top pointer
md pointer to "static" info for the match
eptrb pointer to chain of blocks containing eptr at start of
@@ -475,8 +464,7 @@ Returns: MATCH_MATCH if matched ) these values are >= 0
static int
match(REGISTER USPTR eptr, REGISTER const uschar *ecode, USPTR mstart,
- const uschar *markptr, int offset_top, match_data *md, eptrblock *eptrb,
- unsigned int rdepth)
+ int offset_top, match_data *md, eptrblock *eptrb, unsigned int rdepth)
{
/* These variables do not need to be preserved over recursion in this function,
so they can be ordinary variables in all cases. Mark some of them with
@@ -506,7 +494,6 @@ frame->Xprevframe = NULL; /* Marks the top level */
frame->Xeptr = eptr;
frame->Xecode = ecode;
frame->Xmstart = mstart;
-frame->Xmarkptr = markptr;
frame->Xoffset_top = offset_top;
frame->Xeptrb = eptrb;
frame->Xrdepth = rdepth;
@@ -520,7 +507,6 @@ HEAP_RECURSE:
#define eptr frame->Xeptr
#define ecode frame->Xecode
#define mstart frame->Xmstart
-#define markptr frame->Xmarkptr
#define offset_top frame->Xoffset_top
#define eptrb frame->Xeptrb
#define rdepth frame->Xrdepth
@@ -701,9 +687,12 @@ for (;;)
switch(op)
{
case OP_MARK:
- markptr = ecode + 2;
+ md->nomatch_mark = ecode + 2;
+ md->mark = NULL; /* In case previously set by assertion */
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
eptrb, RM55);
+ if ((rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) &&
+ md->mark == NULL) md->mark = ecode + 2;
/* A return of MATCH_SKIP_ARG means that matching failed at SKIP with an
argument, and we must check whether that argument matches this MARK's
@@ -712,18 +701,16 @@ for (;;)
position and return MATCH_SKIP. Otherwise, pass back the return code
unaltered. */
- if (rrc == MATCH_SKIP_ARG &&
- strcmp((char *)markptr, (char *)(md->start_match_ptr)) == 0)
+ else if (rrc == MATCH_SKIP_ARG &&
+ strcmp((char *)(ecode + 2), (char *)(md->start_match_ptr)) == 0)
{
md->start_match_ptr = eptr;
RRETURN(MATCH_SKIP);
}
-
- if (md->mark == NULL) md->mark = markptr;
RRETURN(rrc);
case OP_FAIL:
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
/* COMMIT overrides PRUNE, SKIP, and THEN */
@@ -734,7 +721,7 @@ for (;;)
rrc != MATCH_SKIP && rrc != MATCH_SKIP_ARG &&
rrc != MATCH_THEN)
RRETURN(rrc);
- MRRETURN(MATCH_COMMIT);
+ RRETURN(MATCH_COMMIT);
/* PRUNE overrides THEN */
@@ -742,13 +729,16 @@ for (;;)
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md,
eptrb, RM51);
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
- MRRETURN(MATCH_PRUNE);
+ RRETURN(MATCH_PRUNE);
case OP_PRUNE_ARG:
+ md->nomatch_mark = ecode + 2;
+ md->mark = NULL; /* In case previously set by assertion */
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
eptrb, RM56);
+ if ((rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) &&
+ md->mark == NULL) md->mark = ecode + 2;
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc);
- md->mark = ecode + 2;
RRETURN(MATCH_PRUNE);
/* SKIP overrides PRUNE and THEN */
@@ -759,9 +749,18 @@ for (;;)
if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN)
RRETURN(rrc);
md->start_match_ptr = eptr; /* Pass back current position */
- MRRETURN(MATCH_SKIP);
+ RRETURN(MATCH_SKIP);
+
+ /* Note that, for Perl compatibility, SKIP with an argument does NOT set
+ nomatch_mark. There is a flag that disables this opcode when re-matching a
+ pattern that ended with a SKIP for which there was not a matching MARK. */
case OP_SKIP_ARG:
+ if (md->ignore_skip_arg)
+ {
+ ecode += _pcre_OP_lengths[*ecode] + ecode[1];
+ break;
+ }
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, md,
eptrb, RM57);
if (rrc != MATCH_NOMATCH && rrc != MATCH_PRUNE && rrc != MATCH_THEN)
@@ -769,8 +768,8 @@ for (;;)
/* Pass back the current skip name by overloading md->start_match_ptr and
returning the special MATCH_SKIP_ARG return code. This will either be
- caught by a matching MARK, or get to the top, where it is treated the same
- as PRUNE. */
+ caught by a matching MARK, or get to the top, where it causes a rematch
+ with the md->ignore_skip_arg flag set. */
md->start_match_ptr = ecode + 2;
RRETURN(MATCH_SKIP_ARG);
@@ -784,14 +783,17 @@ for (;;)
eptrb, RM54);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
md->start_match_ptr = ecode;
- MRRETURN(MATCH_THEN);
+ RRETURN(MATCH_THEN);
case OP_THEN_ARG:
+ md->nomatch_mark = ecode + 2;
+ md->mark = NULL; /* In case previously set by assertion */
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top,
md, eptrb, RM58);
+ if ((rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) &&
+ md->mark == NULL) md->mark = ecode + 2;
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
md->start_match_ptr = ecode;
- md->mark = ecode + 2;
RRETURN(MATCH_THEN);
/* Handle an atomic group that does not contain any capturing parentheses.
@@ -953,7 +955,6 @@ for (;;)
/* At this point, rrc will be one of MATCH_ONCE or MATCH_NOMATCH. */
- if (md->mark == NULL) md->mark = markptr;
RRETURN(rrc);
}
@@ -1041,7 +1042,6 @@ for (;;)
if (*ecode != OP_ALT) break;
}
- if (md->mark == NULL) md->mark = markptr;
RRETURN(MATCH_NOMATCH);
/* Handle possessive capturing brackets with an unlimited repeat. We come
@@ -1070,7 +1070,7 @@ for (;;)
if (offset < md->offset_max)
{
matched_once = FALSE;
- code_offset = ecode - md->start_code;
+ code_offset = (int)(ecode - md->start_code);
save_offset1 = md->offset_vector[offset];
save_offset2 = md->offset_vector[offset+1];
@@ -1129,7 +1129,6 @@ for (;;)
md->offset_vector[md->offset_end - number] = save_offset3;
}
- if (md->mark == NULL) md->mark = markptr;
if (allow_zero || matched_once)
{
ecode += 1 + LINK_SIZE;
@@ -1161,7 +1160,7 @@ for (;;)
POSSESSIVE_NON_CAPTURE:
matched_once = FALSE;
- code_offset = ecode - md->start_code;
+ code_offset = (int)(ecode - md->start_code);
for (;;)
{
@@ -1231,8 +1230,8 @@ for (;;)
cb.capture_top = offset_top/2;
cb.capture_last = md->capture_last;
cb.callout_data = md->callout_data;
- cb.mark = markptr;
- if ((rrc = (*pcre_callout)(&cb)) > 0) MRRETURN(MATCH_NOMATCH);
+ cb.mark = md->nomatch_mark;
+ if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH);
if (rrc < 0) RRETURN(rrc);
}
ecode += _pcre_OP_lengths[OP_CALLOUT];
@@ -1252,14 +1251,14 @@ for (;;)
else
{
int recno = GET2(ecode, LINK_SIZE + 2); /* Recursion group number*/
- condition = (recno == RREF_ANY || recno == md->recursive->group_num);
+ condition = (recno == RREF_ANY || recno == md->recursive->group_num);
/* If the test is for recursion into a specific subpattern, and it is
false, but the test was set up by name, scan the table to see if the
name refers to any other numbers, and test them. The condition is true
if any one is set. */
- if (!condition && condcode == OP_NRREF && recno != RREF_ANY)
+ if (!condition && condcode == OP_NRREF)
{
uschar *slotA = md->name_table;
for (i = 0; i < md->name_count; i++)
@@ -1487,7 +1486,7 @@ for (;;)
(md->notempty ||
(md->notempty_atstart &&
mstart == md->start_subject + md->start_offset)))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
/* Otherwise, we have a match. */
@@ -1496,10 +1495,10 @@ for (;;)
md->start_match_ptr = mstart; /* and the start (\K can modify) */
/* For some reason, the macros don't work properly if an expression is
- given as the argument to MRRETURN when the heap is in use. */
+ given as the argument to RRETURN when the heap is in use. */
rrc = (op == OP_END)? MATCH_MATCH : MATCH_ACCEPT;
- MRRETURN(rrc);
+ RRETURN(rrc);
/* Assertion brackets. Check the alternative branches in turn - the
matching won't pass the KET for an assertion. If any one branch matches,
@@ -1527,7 +1526,6 @@ for (;;)
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)
{
mstart = md->start_match_ptr; /* In case \K reset it */
- markptr = md->mark;
break;
}
@@ -1539,7 +1537,7 @@ for (;;)
}
while (*ecode == OP_ALT);
- if (*ecode == OP_KET) MRRETURN(MATCH_NOMATCH);
+ if (*ecode == OP_KET) RRETURN(MATCH_NOMATCH);
/* If checking an assertion for a condition, return MATCH_MATCH. */
@@ -1569,7 +1567,7 @@ for (;;)
do
{
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, NULL, RM5);
- if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) MRRETURN(MATCH_NOMATCH);
+ if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT) RRETURN(MATCH_NOMATCH);
if (rrc == MATCH_SKIP || rrc == MATCH_PRUNE || rrc == MATCH_COMMIT)
{
do ecode += GET(ecode,1); while (*ecode == OP_ALT);
@@ -1602,7 +1600,7 @@ for (;;)
while (i-- > 0)
{
eptr--;
- if (eptr < md->start_subject) MRRETURN(MATCH_NOMATCH);
+ if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
BACKCHAR(eptr);
}
}
@@ -1613,7 +1611,7 @@ for (;;)
{
eptr -= GET(ecode, 1);
- if (eptr < md->start_subject) MRRETURN(MATCH_NOMATCH);
+ if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
}
/* Save the earliest consulted character, then skip to next op code */
@@ -1642,8 +1640,8 @@ for (;;)
cb.capture_top = offset_top/2;
cb.capture_last = md->capture_last;
cb.callout_data = md->callout_data;
- cb.mark = markptr;
- if ((rrc = (*pcre_callout)(&cb)) > 0) MRRETURN(MATCH_NOMATCH);
+ cb.mark = md->nomatch_mark;
+ if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH);
if (rrc < 0) RRETURN(rrc);
}
ecode += 2 + 2*LINK_SIZE;
@@ -1757,7 +1755,7 @@ for (;;)
md->recursive = new_recursive.prevrec;
if (new_recursive.offset_save != stacksave)
(pcre_free)(new_recursive.offset_save);
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
RECURSION_MATCHED:
@@ -1837,7 +1835,7 @@ for (;;)
md->end_match_ptr = eptr; /* For ONCE_NC */
md->end_offset_top = offset_top;
md->start_match_ptr = mstart;
- MRRETURN(MATCH_MATCH); /* Sets md->mark */
+ RRETURN(MATCH_MATCH); /* Sets md->mark */
}
/* For capturing groups we have to check the group number back at the start
@@ -1979,29 +1977,29 @@ for (;;)
/* Not multiline mode: start of subject assertion, unless notbol. */
case OP_CIRC:
- if (md->notbol && eptr == md->start_subject) MRRETURN(MATCH_NOMATCH);
+ if (md->notbol && eptr == md->start_subject) RRETURN(MATCH_NOMATCH);
/* Start of subject assertion */
case OP_SOD:
- if (eptr != md->start_subject) MRRETURN(MATCH_NOMATCH);
+ if (eptr != md->start_subject) RRETURN(MATCH_NOMATCH);
ecode++;
break;
/* Multiline mode: start of subject unless notbol, or after any newline. */
case OP_CIRCM:
- if (md->notbol && eptr == md->start_subject) MRRETURN(MATCH_NOMATCH);
+ if (md->notbol && eptr == md->start_subject) RRETURN(MATCH_NOMATCH);
if (eptr != md->start_subject &&
(eptr == md->end_subject || !WAS_NEWLINE(eptr)))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
ecode++;
break;
/* Start of match assertion */
case OP_SOM:
- if (eptr != md->start_subject + md->start_offset) MRRETURN(MATCH_NOMATCH);
+ if (eptr != md->start_subject + md->start_offset) RRETURN(MATCH_NOMATCH);
ecode++;
break;
@@ -2017,10 +2015,10 @@ for (;;)
case OP_DOLLM:
if (eptr < md->end_subject)
- { if (!IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH); }
+ { if (!IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH); }
else
{
- if (md->noteol) MRRETURN(MATCH_NOMATCH);
+ if (md->noteol) RRETURN(MATCH_NOMATCH);
SCHECK_PARTIAL();
}
ecode++;
@@ -2030,7 +2028,7 @@ for (;;)
subject unless noteol is set. */
case OP_DOLL:
- if (md->noteol) MRRETURN(MATCH_NOMATCH);
+ if (md->noteol) RRETURN(MATCH_NOMATCH);
if (!md->endonly) goto ASSERT_NL_OR_EOS;
/* ... else fall through for endonly */
@@ -2038,7 +2036,7 @@ for (;;)
/* End of subject assertion (\z) */
case OP_EOD:
- if (eptr < md->end_subject) MRRETURN(MATCH_NOMATCH);
+ if (eptr < md->end_subject) RRETURN(MATCH_NOMATCH);
SCHECK_PARTIAL();
ecode++;
break;
@@ -2049,7 +2047,7 @@ for (;;)
ASSERT_NL_OR_EOS:
if (eptr < md->end_subject &&
(!IS_NEWLINE(eptr) || eptr != md->end_subject - md->nllen))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
/* Either at end of string or \n before end. */
@@ -2171,21 +2169,21 @@ for (;;)
if ((*ecode++ == OP_WORD_BOUNDARY)?
cur_is_word == prev_is_word : cur_is_word != prev_is_word)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
/* Match a single character type; inline for speed */
case OP_ANY:
- if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH);
+ if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
/* Fall through */
case OP_ALLANY:
if (eptr >= md->end_subject) /* DO NOT merge the eptr++ here; it must */
{ /* not be updated before SCHECK_PARTIAL. */
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
eptr++;
if (utf8) while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
@@ -2199,7 +2197,7 @@ for (;;)
if (eptr >= md->end_subject) /* DO NOT merge the eptr++ here; it must */
{ /* not be updated before SCHECK_PARTIAL. */
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
eptr++;
ecode++;
@@ -2209,7 +2207,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if (
@@ -2218,7 +2216,7 @@ for (;;)
#endif
(md->ctypes[c] & ctype_digit) != 0
)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
ecode++;
break;
@@ -2226,7 +2224,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if (
@@ -2235,7 +2233,7 @@ for (;;)
#endif
(md->ctypes[c] & ctype_digit) == 0
)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
ecode++;
break;
@@ -2243,7 +2241,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if (
@@ -2252,7 +2250,7 @@ for (;;)
#endif
(md->ctypes[c] & ctype_space) != 0
)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
ecode++;
break;
@@ -2260,7 +2258,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if (
@@ -2269,7 +2267,7 @@ for (;;)
#endif
(md->ctypes[c] & ctype_space) == 0
)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
ecode++;
break;
@@ -2277,7 +2275,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if (
@@ -2286,7 +2284,7 @@ for (;;)
#endif
(md->ctypes[c] & ctype_word) != 0
)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
ecode++;
break;
@@ -2294,7 +2292,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if (
@@ -2303,7 +2301,7 @@ for (;;)
#endif
(md->ctypes[c] & ctype_word) == 0
)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
ecode++;
break;
@@ -2311,12 +2309,12 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x000d:
if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
@@ -2330,7 +2328,7 @@ for (;;)
case 0x0085:
case 0x2028:
case 0x2029:
- if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH);
+ if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
break;
}
ecode++;
@@ -2340,7 +2338,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
switch(c)
@@ -2365,7 +2363,7 @@ for (;;)
case 0x202f: /* NARROW NO-BREAK SPACE */
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */
case 0x3000: /* IDEOGRAPHIC SPACE */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
ecode++;
break;
@@ -2374,12 +2372,12 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x09: /* HT */
case 0x20: /* SPACE */
case 0xa0: /* NBSP */
@@ -2408,7 +2406,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
switch(c)
@@ -2421,7 +2419,7 @@ for (;;)
case 0x85: /* NEL */
case 0x2028: /* LINE SEPARATOR */
case 0x2029: /* PARAGRAPH SEPARATOR */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
ecode++;
break;
@@ -2430,12 +2428,12 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x0a: /* LF */
case 0x0b: /* VT */
case 0x0c: /* FF */
@@ -2457,7 +2455,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
{
@@ -2466,29 +2464,29 @@ for (;;)
switch(ecode[1])
{
case PT_ANY:
- if (op == OP_NOTPROP) MRRETURN(MATCH_NOMATCH);
+ if (op == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
break;
case PT_LAMP:
if ((prop->chartype == ucp_Lu ||
prop->chartype == ucp_Ll ||
prop->chartype == ucp_Lt) == (op == OP_NOTPROP))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
case PT_GC:
if ((ecode[2] != _pcre_ucp_gentype[prop->chartype]) == (op == OP_PROP))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
case PT_PC:
if ((ecode[2] != prop->chartype) == (op == OP_PROP))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
case PT_SC:
if ((ecode[2] != prop->script) == (op == OP_PROP))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
/* These are specials */
@@ -2496,14 +2494,14 @@ for (;;)
case PT_ALNUM:
if ((_pcre_ucp_gentype[prop->chartype] == ucp_L ||
_pcre_ucp_gentype[prop->chartype] == ucp_N) == (op == OP_NOTPROP))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
case PT_SPACE: /* Perl space */
if ((_pcre_ucp_gentype[prop->chartype] == ucp_Z ||
c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR)
== (op == OP_NOTPROP))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
case PT_PXSPACE: /* POSIX space */
@@ -2511,14 +2509,14 @@ for (;;)
c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||
c == CHAR_FF || c == CHAR_CR)
== (op == OP_NOTPROP))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
case PT_WORD:
if ((_pcre_ucp_gentype[prop->chartype] == ucp_L ||
_pcre_ucp_gentype[prop->chartype] == ucp_N ||
c == CHAR_UNDERSCORE) == (op == OP_NOTPROP))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
/* This should never occur */
@@ -2538,10 +2536,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
- if (UCD_CATEGORY(c) == ucp_M) MRRETURN(MATCH_NOMATCH);
+ if (UCD_CATEGORY(c) == ucp_M) RRETURN(MATCH_NOMATCH);
while (eptr < md->end_subject)
{
int len = 1;
@@ -2615,7 +2613,7 @@ for (;;)
if ((length = match_ref(offset, eptr, length, md, caseless)) < 0)
{
CHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
eptr += length;
continue; /* With the main loop */
@@ -2636,7 +2634,7 @@ for (;;)
if ((slength = match_ref(offset, eptr, length, md, caseless)) < 0)
{
CHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
eptr += slength;
}
@@ -2655,11 +2653,11 @@ for (;;)
int slength;
RMATCH(eptr, ecode, offset_top, md, eptrb, RM14);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if ((slength = match_ref(offset, eptr, length, md, caseless)) < 0)
{
CHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
eptr += slength;
}
@@ -2687,7 +2685,7 @@ for (;;)
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
eptr -= length;
}
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -2748,16 +2746,16 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(c, eptr);
if (c > 255)
{
- if (op == OP_CLASS) MRRETURN(MATCH_NOMATCH);
+ if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);
}
else
{
- if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH);
+ if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
}
}
}
@@ -2770,10 +2768,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
c = *eptr++;
- if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH);
+ if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
}
}
@@ -2795,20 +2793,20 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM16);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(c, eptr);
if (c > 255)
{
- if (op == OP_CLASS) MRRETURN(MATCH_NOMATCH);
+ if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);
}
else
{
- if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH);
+ if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
}
}
}
@@ -2820,14 +2818,14 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM17);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
c = *eptr++;
- if ((data[c/8] & (1 << (c&7))) == 0) MRRETURN(MATCH_NOMATCH);
+ if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
}
}
/* Control never gets here */
@@ -2893,7 +2891,7 @@ for (;;)
}
}
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
}
/* Control never gets here */
@@ -2945,10 +2943,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
- if (!_pcre_xclass(c, data)) MRRETURN(MATCH_NOMATCH);
+ if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH);
}
/* If max == min we can continue with the main loop without the
@@ -2965,14 +2963,14 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM20);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
- if (!_pcre_xclass(c, data)) MRRETURN(MATCH_NOMATCH);
+ if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
}
@@ -3001,7 +2999,7 @@ for (;;)
if (eptr-- == pp) break; /* Stop if tried at original pos */
if (utf8) BACKCHAR(eptr);
}
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -3020,9 +3018,9 @@ for (;;)
if (length > md->end_subject - eptr)
{
CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- while (length-- > 0) if (*ecode++ != *eptr++) MRRETURN(MATCH_NOMATCH);
+ while (length-- > 0) if (*ecode++ != *eptr++) RRETURN(MATCH_NOMATCH);
}
else
#endif
@@ -3032,16 +3030,23 @@ for (;;)
if (md->end_subject - eptr < 1)
{
SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if (ecode[1] != *eptr++) MRRETURN(MATCH_NOMATCH);
+ if (ecode[1] != *eptr++) RRETURN(MATCH_NOMATCH);
ecode += 2;
}
break;
- /* Match a single character, caselessly */
+ /* Match a single character, caselessly. If we are at the end of the
+ subject, give up immediately. */
case OP_CHARI:
+ if (eptr >= md->end_subject)
+ {
+ SCHECK_PARTIAL();
+ RRETURN(MATCH_NOMATCH);
+ }
+
#ifdef SUPPORT_UTF8
if (utf8)
{
@@ -3049,21 +3054,19 @@ for (;;)
ecode++;
GETCHARLEN(fc, ecode, length);
- if (length > md->end_subject - eptr)
- {
- CHECK_PARTIAL(); /* Not SCHECK_PARTIAL() */
- MRRETURN(MATCH_NOMATCH);
- }
-
/* If the pattern character's value is < 128, we have only one byte, and
- can use the fast lookup table. */
+ we know that its other case must also be one byte long, so we can use the
+ fast lookup table. We know that there is at least one byte left in the
+ subject. */
if (fc < 128)
{
- if (md->lcc[*ecode++] != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH);
+ if (md->lcc[*ecode++] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
}
- /* Otherwise we must pick up the subject character */
+ /* Otherwise we must pick up the subject character. Note that we cannot
+ use the value of "length" to check for sufficient bytes left, because the
+ other case of the character may have more or fewer bytes. */
else
{
@@ -3079,7 +3082,7 @@ for (;;)
#ifdef SUPPORT_UCP
if (dc != UCD_OTHERCASE(fc))
#endif
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
}
}
@@ -3088,12 +3091,7 @@ for (;;)
/* Non-UTF-8 mode */
{
- if (md->end_subject - eptr < 1)
- {
- SCHECK_PARTIAL(); /* This one can use SCHECK_PARTIAL() */
- MRRETURN(MATCH_NOMATCH);
- }
- if (md->lcc[ecode[1]] != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH);
+ if (md->lcc[ecode[1]] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
ecode += 2;
}
break;
@@ -3199,7 +3197,7 @@ for (;;)
else
{
CHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
}
@@ -3211,7 +3209,7 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM22);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr <= md->end_subject - length &&
memcmp(eptr, charptr, length) == 0) eptr += length;
#ifdef SUPPORT_UCP
@@ -3222,7 +3220,7 @@ for (;;)
else
{
CHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
}
/* Control never gets here */
@@ -3253,7 +3251,7 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM23);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (eptr == pp) { MRRETURN(MATCH_NOMATCH); }
+ if (eptr == pp) { RRETURN(MATCH_NOMATCH); }
#ifdef SUPPORT_UCP
eptr--;
BACKCHAR(eptr);
@@ -3296,9 +3294,9 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if (fc != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH);
+ if (fc != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
}
if (min == max) continue;
if (minimize)
@@ -3307,13 +3305,13 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM24);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if (fc != md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH);
+ if (fc != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
}
@@ -3339,7 +3337,7 @@ for (;;)
eptr--;
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
}
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
}
@@ -3353,9 +3351,9 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if (fc != *eptr++) MRRETURN(MATCH_NOMATCH);
+ if (fc != *eptr++) RRETURN(MATCH_NOMATCH);
}
if (min == max) continue;
@@ -3366,13 +3364,13 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM26);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if (fc != *eptr++) MRRETURN(MATCH_NOMATCH);
+ if (fc != *eptr++) RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
}
@@ -3397,7 +3395,7 @@ for (;;)
eptr--;
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
}
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
}
/* Control never gets here */
@@ -3410,7 +3408,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
ecode++;
GETCHARINCTEST(c, eptr);
@@ -3420,11 +3418,11 @@ for (;;)
if (c < 256)
#endif
c = md->lcc[c];
- if (md->lcc[*ecode++] == c) MRRETURN(MATCH_NOMATCH);
+ if (md->lcc[*ecode++] == c) RRETURN(MATCH_NOMATCH);
}
else /* Caseful */
{
- if (*ecode++ == c) MRRETURN(MATCH_NOMATCH);
+ if (*ecode++ == c) RRETURN(MATCH_NOMATCH);
}
break;
@@ -3531,11 +3529,11 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(d, eptr);
if (d < 256) d = md->lcc[d];
- if (fc == d) MRRETURN(MATCH_NOMATCH);
+ if (fc == d) RRETURN(MATCH_NOMATCH);
}
}
else
@@ -3548,9 +3546,9 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if (fc == md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH);
+ if (fc == md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
}
}
@@ -3567,15 +3565,15 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM28);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(d, eptr);
if (d < 256) d = md->lcc[d];
- if (fc == d) MRRETURN(MATCH_NOMATCH);
+ if (fc == d) RRETURN(MATCH_NOMATCH);
}
}
else
@@ -3586,13 +3584,13 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM29);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if (fc == md->lcc[*eptr++]) MRRETURN(MATCH_NOMATCH);
+ if (fc == md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
}
}
/* Control never gets here */
@@ -3654,7 +3652,7 @@ for (;;)
}
}
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
}
@@ -3673,10 +3671,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(d, eptr);
- if (fc == d) MRRETURN(MATCH_NOMATCH);
+ if (fc == d) RRETURN(MATCH_NOMATCH);
}
}
else
@@ -3688,9 +3686,9 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if (fc == *eptr++) MRRETURN(MATCH_NOMATCH);
+ if (fc == *eptr++) RRETURN(MATCH_NOMATCH);
}
}
@@ -3707,14 +3705,14 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM32);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(d, eptr);
- if (fc == d) MRRETURN(MATCH_NOMATCH);
+ if (fc == d) RRETURN(MATCH_NOMATCH);
}
}
else
@@ -3725,13 +3723,13 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM33);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if (fc == *eptr++) MRRETURN(MATCH_NOMATCH);
+ if (fc == *eptr++) RRETURN(MATCH_NOMATCH);
}
}
/* Control never gets here */
@@ -3792,7 +3790,7 @@ for (;;)
}
}
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
}
/* Control never gets here */
@@ -3886,13 +3884,13 @@ for (;;)
switch(prop_type)
{
case PT_ANY:
- if (prop_fail_result) MRRETURN(MATCH_NOMATCH);
+ if (prop_fail_result) RRETURN(MATCH_NOMATCH);
for (i = 1; i <= min; i++)
{
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
}
@@ -3905,14 +3903,14 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
chartype = UCD_CHARTYPE(c);
if ((chartype == ucp_Lu ||
chartype == ucp_Ll ||
chartype == ucp_Lt) == prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
@@ -3922,11 +3920,11 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if ((UCD_CATEGORY(c) == prop_value) == prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
@@ -3936,11 +3934,11 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if ((UCD_CHARTYPE(c) == prop_value) == prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
@@ -3950,11 +3948,11 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if ((UCD_SCRIPT(c) == prop_value) == prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
@@ -3965,12 +3963,12 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
category = UCD_CATEGORY(c);
if ((category == ucp_L || category == ucp_N) == prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
@@ -3980,13 +3978,13 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if ((UCD_CATEGORY(c) == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
c == CHAR_FF || c == CHAR_CR)
== prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
@@ -3996,13 +3994,13 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if ((UCD_CATEGORY(c) == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
== prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
@@ -4013,13 +4011,13 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
category = UCD_CATEGORY(c);
if ((category == ucp_L || category == ucp_N || c == CHAR_UNDERSCORE)
== prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
@@ -4040,10 +4038,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
- if (UCD_CATEGORY(c) == ucp_M) MRRETURN(MATCH_NOMATCH);
+ if (UCD_CATEGORY(c) == ucp_M) RRETURN(MATCH_NOMATCH);
while (eptr < md->end_subject)
{
int len = 1;
@@ -4068,9 +4066,9 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH);
+ if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
eptr++;
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
}
@@ -4082,7 +4080,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
eptr++;
while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
@@ -4090,7 +4088,7 @@ for (;;)
break;
case OP_ANYBYTE:
- if (eptr > md->end_subject - min) MRRETURN(MATCH_NOMATCH);
+ if (eptr > md->end_subject - min) RRETURN(MATCH_NOMATCH);
eptr += min;
break;
@@ -4100,12 +4098,12 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(c, eptr);
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x000d:
if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
@@ -4119,7 +4117,7 @@ for (;;)
case 0x0085:
case 0x2028:
case 0x2029:
- if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH);
+ if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
break;
}
}
@@ -4131,7 +4129,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(c, eptr);
switch(c)
@@ -4156,7 +4154,7 @@ for (;;)
case 0x202f: /* NARROW NO-BREAK SPACE */
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */
case 0x3000: /* IDEOGRAPHIC SPACE */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
}
break;
@@ -4167,12 +4165,12 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(c, eptr);
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x09: /* HT */
case 0x20: /* SPACE */
case 0xa0: /* NBSP */
@@ -4203,7 +4201,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(c, eptr);
switch(c)
@@ -4216,7 +4214,7 @@ for (;;)
case 0x85: /* NEL */
case 0x2028: /* LINE SEPARATOR */
case 0x2029: /* PARAGRAPH SEPARATOR */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
}
break;
@@ -4227,12 +4225,12 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(c, eptr);
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x0a: /* LF */
case 0x0b: /* VT */
case 0x0c: /* FF */
@@ -4251,11 +4249,11 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINC(c, eptr);
if (c < 128 && (md->ctypes[c] & ctype_digit) != 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
@@ -4265,10 +4263,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_digit) == 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
/* No need to skip more bytes - we know it's a 1-byte character */
}
break;
@@ -4279,10 +4277,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_space) != 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80);
}
break;
@@ -4293,10 +4291,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_space) == 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
/* No need to skip more bytes - we know it's a 1-byte character */
}
break;
@@ -4307,10 +4305,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
if (*eptr < 128 && (md->ctypes[*eptr] & ctype_word) != 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
while (++eptr < md->end_subject && (*eptr & 0xc0) == 0x80);
}
break;
@@ -4321,10 +4319,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
if (*eptr >= 128 || (md->ctypes[*eptr++] & ctype_word) == 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
/* No need to skip more bytes - we know it's a 1-byte character */
}
break;
@@ -4347,9 +4345,9 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if (IS_NEWLINE(eptr)) MRRETURN(MATCH_NOMATCH);
+ if (IS_NEWLINE(eptr)) RRETURN(MATCH_NOMATCH);
eptr++;
}
break;
@@ -4358,7 +4356,7 @@ for (;;)
if (eptr > md->end_subject - min)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
eptr += min;
break;
@@ -4367,7 +4365,7 @@ for (;;)
if (eptr > md->end_subject - min)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
eptr += min;
break;
@@ -4378,11 +4376,11 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
switch(*eptr++)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x000d:
if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
@@ -4394,7 +4392,7 @@ for (;;)
case 0x000b:
case 0x000c:
case 0x0085:
- if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH);
+ if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
break;
}
}
@@ -4406,7 +4404,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
switch(*eptr++)
{
@@ -4414,7 +4412,7 @@ for (;;)
case 0x09: /* HT */
case 0x20: /* SPACE */
case 0xa0: /* NBSP */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
}
break;
@@ -4425,11 +4423,11 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
switch(*eptr++)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x09: /* HT */
case 0x20: /* SPACE */
case 0xa0: /* NBSP */
@@ -4444,7 +4442,7 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
switch(*eptr++)
{
@@ -4454,7 +4452,7 @@ for (;;)
case 0x0c: /* FF */
case 0x0d: /* CR */
case 0x85: /* NEL */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
}
break;
@@ -4465,11 +4463,11 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
switch(*eptr++)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x0a: /* LF */
case 0x0b: /* VT */
case 0x0c: /* FF */
@@ -4486,9 +4484,9 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if ((md->ctypes[*eptr++] & ctype_digit) != 0) MRRETURN(MATCH_NOMATCH);
+ if ((md->ctypes[*eptr++] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH);
}
break;
@@ -4498,9 +4496,9 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if ((md->ctypes[*eptr++] & ctype_digit) == 0) MRRETURN(MATCH_NOMATCH);
+ if ((md->ctypes[*eptr++] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH);
}
break;
@@ -4510,9 +4508,9 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if ((md->ctypes[*eptr++] & ctype_space) != 0) MRRETURN(MATCH_NOMATCH);
+ if ((md->ctypes[*eptr++] & ctype_space) != 0) RRETURN(MATCH_NOMATCH);
}
break;
@@ -4522,9 +4520,9 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
- if ((md->ctypes[*eptr++] & ctype_space) == 0) MRRETURN(MATCH_NOMATCH);
+ if ((md->ctypes[*eptr++] & ctype_space) == 0) RRETURN(MATCH_NOMATCH);
}
break;
@@ -4534,10 +4532,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
if ((md->ctypes[*eptr++] & ctype_word) != 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
@@ -4547,10 +4545,10 @@ for (;;)
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
if ((md->ctypes[*eptr++] & ctype_word) == 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
@@ -4579,14 +4577,14 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM36);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
- if (prop_fail_result) MRRETURN(MATCH_NOMATCH);
+ if (prop_fail_result) RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -4596,18 +4594,18 @@ for (;;)
int chartype;
RMATCH(eptr, ecode, offset_top, md, eptrb, RM37);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
chartype = UCD_CHARTYPE(c);
if ((chartype == ucp_Lu ||
chartype == ucp_Ll ||
chartype == ucp_Lt) == prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -4616,15 +4614,15 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM38);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if ((UCD_CATEGORY(c) == prop_value) == prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -4633,15 +4631,15 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM39);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if ((UCD_CHARTYPE(c) == prop_value) == prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -4650,15 +4648,15 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM40);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if ((UCD_SCRIPT(c) == prop_value) == prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -4668,16 +4666,16 @@ for (;;)
int category;
RMATCH(eptr, ecode, offset_top, md, eptrb, RM59);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
category = UCD_CATEGORY(c);
if ((category == ucp_L || category == ucp_N) == prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -4686,17 +4684,17 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM60);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if ((UCD_CATEGORY(c) == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
c == CHAR_FF || c == CHAR_CR)
== prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -4705,17 +4703,17 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM61);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
if ((UCD_CATEGORY(c) == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
== prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -4725,11 +4723,11 @@ for (;;)
int category;
RMATCH(eptr, ecode, offset_top, md, eptrb, RM62);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
category = UCD_CATEGORY(c);
@@ -4737,7 +4735,7 @@ for (;;)
category == ucp_N ||
c == CHAR_UNDERSCORE)
== prop_fail_result)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -4757,14 +4755,14 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM41);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
- if (UCD_CATEGORY(c) == ucp_M) MRRETURN(MATCH_NOMATCH);
+ if (UCD_CATEGORY(c) == ucp_M) RRETURN(MATCH_NOMATCH);
while (eptr < md->end_subject)
{
int len = 1;
@@ -4785,14 +4783,14 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM42);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
if (ctype == OP_ANY && IS_NEWLINE(eptr))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
GETCHARINC(c, eptr);
switch(ctype)
{
@@ -4804,7 +4802,7 @@ for (;;)
case OP_ANYNL:
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x000d:
if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
break;
@@ -4816,7 +4814,7 @@ for (;;)
case 0x0085:
case 0x2028:
case 0x2029:
- if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH);
+ if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
break;
}
break;
@@ -4844,14 +4842,14 @@ for (;;)
case 0x202f: /* NARROW NO-BREAK SPACE */
case 0x205f: /* MEDIUM MATHEMATICAL SPACE */
case 0x3000: /* IDEOGRAPHIC SPACE */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
case OP_HSPACE:
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x09: /* HT */
case 0x20: /* SPACE */
case 0xa0: /* NBSP */
@@ -4886,14 +4884,14 @@ for (;;)
case 0x85: /* NEL */
case 0x2028: /* LINE SEPARATOR */
case 0x2029: /* PARAGRAPH SEPARATOR */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
case OP_VSPACE:
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x0a: /* LF */
case 0x0b: /* VT */
case 0x0c: /* FF */
@@ -4907,32 +4905,32 @@ for (;;)
case OP_NOT_DIGIT:
if (c < 256 && (md->ctypes[c] & ctype_digit) != 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
case OP_DIGIT:
if (c >= 256 || (md->ctypes[c] & ctype_digit) == 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
case OP_NOT_WHITESPACE:
if (c < 256 && (md->ctypes[c] & ctype_space) != 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
case OP_WHITESPACE:
if (c >= 256 || (md->ctypes[c] & ctype_space) == 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
case OP_NOT_WORDCHAR:
if (c < 256 && (md->ctypes[c] & ctype_word) != 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
case OP_WORDCHAR:
if (c >= 256 || (md->ctypes[c] & ctype_word) == 0)
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
break;
default:
@@ -4948,14 +4946,14 @@ for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM43);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) MRRETURN(MATCH_NOMATCH);
+ if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
{
SCHECK_PARTIAL();
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
if (ctype == OP_ANY && IS_NEWLINE(eptr))
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
c = *eptr++;
switch(ctype)
{
@@ -4967,7 +4965,7 @@ for (;;)
case OP_ANYNL:
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x000d:
if (eptr < md->end_subject && *eptr == 0x0a) eptr++;
break;
@@ -4978,7 +4976,7 @@ for (;;)
case 0x000b:
case 0x000c:
case 0x0085:
- if (md->bsr_anycrlf) MRRETURN(MATCH_NOMATCH);
+ if (md->bsr_anycrlf) RRETURN(MATCH_NOMATCH);
break;
}
break;
@@ -4990,14 +4988,14 @@ for (;;)
case 0x09: /* HT */
case 0x20: /* SPACE */
case 0xa0: /* NBSP */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
case OP_HSPACE:
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x09: /* HT */
case 0x20: /* SPACE */
case 0xa0: /* NBSP */
@@ -5014,14 +5012,14 @@ for (;;)
case 0x0c: /* FF */
case 0x0d: /* CR */
case 0x85: /* NEL */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
break;
case OP_VSPACE:
switch(c)
{
- default: MRRETURN(MATCH_NOMATCH);
+ default: RRETURN(MATCH_NOMATCH);
case 0x0a: /* LF */
case 0x0b: /* VT */
case 0x0c: /* FF */
@@ -5032,27 +5030,27 @@ for (;;)
break;
case OP_NOT_DIGIT:
- if ((md->ctypes[c] & ctype_digit) != 0) MRRETURN(MATCH_NOMATCH);
+ if ((md->ctypes[c] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH);
break;
case OP_DIGIT:
- if ((md->ctypes[c] & ctype_digit) == 0) MRRETURN(MATCH_NOMATCH);
+ if ((md->ctypes[c] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH);
break;
case OP_NOT_WHITESPACE:
- if ((md->ctypes[c] & ctype_space) != 0) MRRETURN(MATCH_NOMATCH);
+ if ((md->ctypes[c] & ctype_space) != 0) RRETURN(MATCH_NOMATCH);
break;
case OP_WHITESPACE:
- if ((md->ctypes[c] & ctype_space) == 0) MRRETURN(MATCH_NOMATCH);
+ if ((md->ctypes[c] & ctype_space) == 0) RRETURN(MATCH_NOMATCH);
break;
case OP_NOT_WORDCHAR:
- if ((md->ctypes[c] & ctype_word) != 0) MRRETURN(MATCH_NOMATCH);
+ if ((md->ctypes[c] & ctype_word) != 0) RRETURN(MATCH_NOMATCH);
break;
case OP_WORDCHAR:
- if ((md->ctypes[c] & ctype_word) == 0) MRRETURN(MATCH_NOMATCH);
+ if ((md->ctypes[c] & ctype_word) == 0) RRETURN(MATCH_NOMATCH);
break;
default:
@@ -5794,7 +5792,7 @@ for (;;)
/* Get here if we can't make it match with any permitted repetitions */
- MRRETURN(MATCH_NOMATCH);
+ RRETURN(MATCH_NOMATCH);
}
/* Control never gets here */
@@ -6011,6 +6009,7 @@ matching. */
if (extra_data != NULL
&& (extra_data->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0
&& extra_data->executable_jit != NULL
+ && (extra_data->flags & PCRE_EXTRA_TABLES) == 0
&& (options & ~(PCRE_NO_UTF8_CHECK | PCRE_NOTBOL | PCRE_NOTEOL |
PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART)) == 0)
return _pcre_jit_exec(re, extra_data->executable_jit, subject, length,
@@ -6088,6 +6087,7 @@ end_subject = md->end_subject;
md->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
md->use_ucp = (re->options & PCRE_UCP) != 0;
md->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;
+md->ignore_skip_arg = FALSE;
/* Some options are unpacked into BOOL variables in the hope that testing
them will be faster than individual option bits. */
@@ -6098,7 +6098,7 @@ md->notempty = (options & PCRE_NOTEMPTY) != 0;
md->notempty_atstart = (options & PCRE_NOTEMPTY_ATSTART) != 0;
md->hitend = FALSE;
-md->mark = NULL; /* In case never set */
+md->mark = md->nomatch_mark = NULL; /* In case never set */
md->recursive = NULL; /* No recursion at top level */
md->hasthen = (re->flags & PCRE_HASTHEN) != 0;
@@ -6450,11 +6450,23 @@ for(;;)
md->match_call_count = 0;
md->match_function_type = 0;
md->end_offset_top = 0;
- rc = match(start_match, md->start_code, start_match, NULL, 2, md, NULL, 0);
+ rc = match(start_match, md->start_code, start_match, 2, md, NULL, 0);
if (md->hitend && start_partial == NULL) start_partial = md->start_used_ptr;
switch(rc)
{
+ /* If MATCH_SKIP_ARG reaches this level it means that a MARK that matched
+ the SKIP's arg was not found. In this circumstance, Perl ignores the SKIP
+ entirely. The only way we can do that is to re-do the match at the same
+ point, with a flag to force SKIP with an argument to be ignored. Just
+ treating this case as NOMATCH does not work because it does not check other
+ alternatives in patterns such as A(*SKIP:A)B|AC when the subject is AC. */
+
+ case MATCH_SKIP_ARG:
+ new_start_match = start_match;
+ md->ignore_skip_arg = TRUE;
+ break;
+
/* SKIP passes back the next starting point explicitly, but if it is the
same as the match we have just done, treat it as NOMATCH. */
@@ -6466,18 +6478,13 @@ for(;;)
}
/* Fall through */
- /* If MATCH_SKIP_ARG reaches this level it means that a MARK that matched
- the SKIP's arg was not found. We also treat this as NOMATCH. */
-
- case MATCH_SKIP_ARG:
- /* Fall through */
-
/* NOMATCH and PRUNE advance by one character. THEN at this level acts
- exactly like PRUNE. */
+ exactly like PRUNE. Unset the ignore SKIP-with-argument flag. */
case MATCH_NOMATCH:
case MATCH_PRUNE:
case MATCH_THEN:
+ md->ignore_skip_arg = FALSE;
new_start_match = start_match + 1;
#ifdef SUPPORT_UTF8
if (utf8)
@@ -6606,8 +6613,12 @@ if (rc == MATCH_MATCH || rc == MATCH_ACCEPT)
offsets[1] = (int)(md->end_match_ptr - md->start_subject);
}
+ /* Return MARK data if requested */
+
+ if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)
+ *(extra_data->mark) = (unsigned char *)(md->mark);
DPRINTF((">>>> returning %d\n", rc));
- goto RETURN_MARK;
+ return rc;
}
/* Control gets here if there has been an error, or if the overall match
@@ -6651,10 +6662,8 @@ else
/* Return the MARK data if it has been requested. */
-RETURN_MARK:
-
if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_MARK) != 0)
- *(extra_data->mark) = (unsigned char *)(md->mark);
+ *(extra_data->mark) = (unsigned char *)(md->nomatch_mark);
return rc;
}
diff --git a/usr.sbin/nginx/src/pcre/pcre_fullinfo.c b/usr.sbin/nginx/src/pcre/pcre_fullinfo.c
index b08067de738..4895b2aab2d 100644
--- a/usr.sbin/nginx/src/pcre/pcre_fullinfo.c
+++ b/usr.sbin/nginx/src/pcre/pcre_fullinfo.c
@@ -100,6 +100,19 @@ switch (what)
*((size_t *)where) = (study == NULL)? 0 : study->size;
break;
+ case PCRE_INFO_JITSIZE:
+#ifdef SUPPORT_JIT
+ *((size_t *)where) =
+ (extra_data != NULL &&
+ (extra_data->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 &&
+ extra_data->executable_jit != NULL)?
+ _pcre_jit_get_size(extra_data->executable_jit) : 0;
+#else
+ *((size_t *)where) = 0;
+#endif
+
+ break;
+
case PCRE_INFO_CAPTURECOUNT:
*((int *)where) = re->top_bracket;
break;
diff --git a/usr.sbin/nginx/src/pcre/pcre_internal.h b/usr.sbin/nginx/src/pcre/pcre_internal.h
index faf1b766ae4..6ea397a39ef 100644
--- a/usr.sbin/nginx/src/pcre/pcre_internal.h
+++ b/usr.sbin/nginx/src/pcre/pcre_internal.h
@@ -1252,8 +1252,8 @@ value such as \n. They must have non-zero values, as check_escape() returns
their negation. Also, they must appear in the same order as in the opcode
definitions below, up to ESC_z. There's a dummy for OP_ALLANY because it
corresponds to "." in DOTALL mode rather than an escape sequence. It is also
-used for [^] in JavaScript compatibility mode. In non-DOTALL mode, "." behaves
-like \N.
+used for [^] in JavaScript compatibility mode, and for \C in non-utf8 mode. In
+non-DOTALL mode, "." behaves like \N.
The special values ESC_DU, ESC_du, etc. are used instead of ESC_D, ESC_d, etc.
when PCRE_UCP is set, when replacement of \d etc by \p sequences is required.
@@ -1665,7 +1665,7 @@ enum { ERR0, ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9,
ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49,
ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59,
ERR60, ERR61, ERR62, ERR63, ERR64, ERR65, ERR66, ERR67, ERR68, ERR69,
- ERRCOUNT };
+ ERR70, ERR71, ERR72, ERRCOUNT };
/* The real format of the start of the pcre block; the index of names and the
code vector run on as long as necessary after the end. We store an explicit
@@ -1741,6 +1741,7 @@ typedef struct compile_data {
uschar *name_table; /* The name/number table */
int names_found; /* Number of entries so far */
int name_entry_size; /* Size of each entry */
+ int workspace_size; /* Size of workspace */
int bracount; /* Count of capturing parens as we compile */
int final_bracount; /* Saved value after first pass */
int top_backref; /* Maximum back reference */
@@ -1824,6 +1825,7 @@ typedef struct match_data {
BOOL hitend; /* Hit the end of the subject at some point */
BOOL bsr_anycrlf; /* \R is just any CRLF, not full Unicode */
BOOL hasthen; /* Pattern contains (*THEN) */
+ BOOL ignore_skip_arg; /* For re-run when SKIP name not found */
const uschar *start_code; /* For use when recursing */
USPTR start_subject; /* Start of the subject string */
USPTR end_subject; /* End of the subject string */
@@ -1839,7 +1841,8 @@ typedef struct match_data {
int eptrn; /* Next free eptrblock */
recursion_info *recursive; /* Linked list of recursion data */
void *callout_data; /* To pass back to callouts */
- const uschar *mark; /* Mark pointer to pass back */
+ const uschar *mark; /* Mark pointer to pass back on success */
+ const uschar *nomatch_mark; /* Mark pointer to pass back on failure */
const uschar *once_target; /* Where to back up to for atomic groups */
} match_data;
@@ -1950,6 +1953,7 @@ extern void _pcre_jit_compile(const real_pcre *, pcre_extra *);
extern int _pcre_jit_exec(const real_pcre *, void *, PCRE_SPTR,
int, int, int, int, int *, int);
extern void _pcre_jit_free(void *);
+extern int _pcre_jit_get_size(void *);
#endif
/* Unicode character database (UCD) */
diff --git a/usr.sbin/nginx/src/pcre/pcre_valid_utf8.c b/usr.sbin/nginx/src/pcre/pcre_valid_utf8.c
index fef65383738..b94bcc98e6b 100644
--- a/usr.sbin/nginx/src/pcre/pcre_valid_utf8.c
+++ b/usr.sbin/nginx/src/pcre/pcre_valid_utf8.c
@@ -111,7 +111,7 @@ register USPTR p;
if (length < 0)
{
for (p = string; *p != 0; p++);
- length = p - string;
+ length = (int)(p - string);
}
for (p = string; length-- > 0; p++)
@@ -123,20 +123,20 @@ for (p = string; length-- > 0; p++)
if (c < 0xc0) /* Isolated 10xx xxxx byte */
{
- *erroroffset = p - string;
+ *erroroffset = (int)(p - string);
return PCRE_UTF8_ERR20;
}
if (c >= 0xfe) /* Invalid 0xfe or 0xff bytes */
{
- *erroroffset = p - string;
+ *erroroffset = (int)(p - string);
return PCRE_UTF8_ERR21;
}
ab = _pcre_utf8_table4[c & 0x3f]; /* Number of additional bytes */
if (length < ab)
{
- *erroroffset = p - string; /* Missing bytes */
+ *erroroffset = (int)(p - string); /* Missing bytes */
return ab - length; /* Codes ERR1 to ERR5 */
}
length -= ab; /* Length remaining */
@@ -145,7 +145,7 @@ for (p = string; length-- > 0; p++)
if (((d = *(++p)) & 0xc0) != 0x80)
{
- *erroroffset = p - string - 1;
+ *erroroffset = (int)(p - string) - 1;
return PCRE_UTF8_ERR6;
}
@@ -160,7 +160,7 @@ for (p = string; length-- > 0; p++)
case 1: if ((c & 0x3e) == 0)
{
- *erroroffset = p - string - 1;
+ *erroroffset = (int)(p - string) - 1;
return PCRE_UTF8_ERR15;
}
break;
@@ -172,17 +172,17 @@ for (p = string; length-- > 0; p++)
case 2:
if ((*(++p) & 0xc0) != 0x80) /* Third byte */
{
- *erroroffset = p - string - 2;
+ *erroroffset = (int)(p - string) - 2;
return PCRE_UTF8_ERR7;
}
if (c == 0xe0 && (d & 0x20) == 0)
{
- *erroroffset = p - string - 2;
+ *erroroffset = (int)(p - string) - 2;
return PCRE_UTF8_ERR16;
}
if (c == 0xed && d >= 0xa0)
{
- *erroroffset = p - string - 2;
+ *erroroffset = (int)(p - string) - 2;
return PCRE_UTF8_ERR14;
}
break;
@@ -194,22 +194,22 @@ for (p = string; length-- > 0; p++)
case 3:
if ((*(++p) & 0xc0) != 0x80) /* Third byte */
{
- *erroroffset = p - string - 2;
+ *erroroffset = (int)(p - string) - 2;
return PCRE_UTF8_ERR7;
}
if ((*(++p) & 0xc0) != 0x80) /* Fourth byte */
{
- *erroroffset = p - string - 3;
+ *erroroffset = (int)(p - string) - 3;
return PCRE_UTF8_ERR8;
}
if (c == 0xf0 && (d & 0x30) == 0)
{
- *erroroffset = p - string - 3;
+ *erroroffset = (int)(p - string) - 3;
return PCRE_UTF8_ERR17;
}
if (c > 0xf4 || (c == 0xf4 && d > 0x8f))
{
- *erroroffset = p - string - 3;
+ *erroroffset = (int)(p - string) - 3;
return PCRE_UTF8_ERR13;
}
break;
@@ -225,22 +225,22 @@ for (p = string; length-- > 0; p++)
case 4:
if ((*(++p) & 0xc0) != 0x80) /* Third byte */
{
- *erroroffset = p - string - 2;
+ *erroroffset = (int)(p - string) - 2;
return PCRE_UTF8_ERR7;
}
if ((*(++p) & 0xc0) != 0x80) /* Fourth byte */
{
- *erroroffset = p - string - 3;
+ *erroroffset = (int)(p - string) - 3;
return PCRE_UTF8_ERR8;
}
if ((*(++p) & 0xc0) != 0x80) /* Fifth byte */
{
- *erroroffset = p - string - 4;
+ *erroroffset = (int)(p - string) - 4;
return PCRE_UTF8_ERR9;
}
if (c == 0xf8 && (d & 0x38) == 0)
{
- *erroroffset = p - string - 4;
+ *erroroffset = (int)(p - string) - 4;
return PCRE_UTF8_ERR18;
}
break;
@@ -251,27 +251,27 @@ for (p = string; length-- > 0; p++)
case 5:
if ((*(++p) & 0xc0) != 0x80) /* Third byte */
{
- *erroroffset = p - string - 2;
+ *erroroffset = (int)(p - string) - 2;
return PCRE_UTF8_ERR7;
}
if ((*(++p) & 0xc0) != 0x80) /* Fourth byte */
{
- *erroroffset = p - string - 3;
+ *erroroffset = (int)(p - string) - 3;
return PCRE_UTF8_ERR8;
}
if ((*(++p) & 0xc0) != 0x80) /* Fifth byte */
{
- *erroroffset = p - string - 4;
+ *erroroffset = (int)(p - string) - 4;
return PCRE_UTF8_ERR9;
}
if ((*(++p) & 0xc0) != 0x80) /* Sixth byte */
{
- *erroroffset = p - string - 5;
+ *erroroffset = (int)(p - string) - 5;
return PCRE_UTF8_ERR10;
}
if (c == 0xfc && (d & 0x3c) == 0)
{
- *erroroffset = p - string - 5;
+ *erroroffset = (int)(p - string) - 5;
return PCRE_UTF8_ERR19;
}
break;
@@ -283,7 +283,7 @@ for (p = string; length-- > 0; p++)
if (ab > 3)
{
- *erroroffset = p - string - ab;
+ *erroroffset = (int)(p - string) - ab;
return (ab == 4)? PCRE_UTF8_ERR11 : PCRE_UTF8_ERR12;
}
}