| 92 |
|
|
| 93 |
#define COMPILE_WORK_SIZE (4096) |
#define COMPILE_WORK_SIZE (4096) |
| 94 |
|
|
| 95 |
|
/* The overrun tests check for a slightly smaller size so that they detect the |
| 96 |
|
overrun before it actually does run off the end of the data block. */ |
| 97 |
|
|
| 98 |
|
#define WORK_SIZE_CHECK (COMPILE_WORK_SIZE - 100) |
| 99 |
|
|
| 100 |
|
|
| 101 |
/* Table for handling escaped characters in the range '0'-'z'. Positive returns |
/* Table for handling escaped characters in the range '0'-'z'. Positive returns |
| 102 |
are simple data values; negative values are for special things like \d and so |
are simple data values; negative values are for special things like \d and so |
| 124 |
-ESC_H, 0, |
-ESC_H, 0, |
| 125 |
0, -ESC_K, |
0, -ESC_K, |
| 126 |
0, 0, |
0, 0, |
| 127 |
0, 0, |
-ESC_N, 0, |
| 128 |
-ESC_P, -ESC_Q, |
-ESC_P, -ESC_Q, |
| 129 |
-ESC_R, -ESC_S, |
-ESC_R, -ESC_S, |
| 130 |
0, 0, |
0, 0, |
| 171 |
/* B8 */ 0, 0, 0, 0, 0, ']', '=', '-', |
/* B8 */ 0, 0, 0, 0, 0, ']', '=', '-', |
| 172 |
/* C0 */ '{',-ESC_A, -ESC_B, -ESC_C, -ESC_D,-ESC_E, 0, -ESC_G, |
/* C0 */ '{',-ESC_A, -ESC_B, -ESC_C, -ESC_D,-ESC_E, 0, -ESC_G, |
| 173 |
/* C8 */-ESC_H, 0, 0, 0, 0, 0, 0, 0, |
/* C8 */-ESC_H, 0, 0, 0, 0, 0, 0, 0, |
| 174 |
/* D0 */ '}', 0, -ESC_K, 0, 0, 0, 0, -ESC_P, |
/* D0 */ '}', 0, -ESC_K, 0, 0,-ESC_N, 0, -ESC_P, |
| 175 |
/* D8 */-ESC_Q,-ESC_R, 0, 0, 0, 0, 0, 0, |
/* D8 */-ESC_Q,-ESC_R, 0, 0, 0, 0, 0, 0, |
| 176 |
/* E0 */ '\\', 0, -ESC_S, 0, 0,-ESC_V, -ESC_W, -ESC_X, |
/* E0 */ '\\', 0, -ESC_S, 0, 0,-ESC_V, -ESC_W, -ESC_X, |
| 177 |
/* E8 */ 0,-ESC_Z, 0, 0, 0, 0, 0, 0, |
/* E8 */ 0,-ESC_Z, 0, 0, 0, 0, 0, 0, |
| 188 |
platforms. */ |
platforms. */ |
| 189 |
|
|
| 190 |
typedef struct verbitem { |
typedef struct verbitem { |
| 191 |
int len; |
int len; /* Length of verb name */ |
| 192 |
int op; |
int op; /* Op when no arg, or -1 if arg mandatory */ |
| 193 |
|
int op_arg; /* Op when arg present, or -1 if not allowed */ |
| 194 |
} verbitem; |
} verbitem; |
| 195 |
|
|
| 196 |
static const char verbnames[] = |
static const char verbnames[] = |
| 197 |
|
"\0" /* Empty name is a shorthand for MARK */ |
| 198 |
|
STRING_MARK0 |
| 199 |
STRING_ACCEPT0 |
STRING_ACCEPT0 |
| 200 |
STRING_COMMIT0 |
STRING_COMMIT0 |
| 201 |
STRING_F0 |
STRING_F0 |
| 205 |
STRING_THEN; |
STRING_THEN; |
| 206 |
|
|
| 207 |
static const verbitem verbs[] = { |
static const verbitem verbs[] = { |
| 208 |
{ 6, OP_ACCEPT }, |
{ 0, -1, OP_MARK }, |
| 209 |
{ 6, OP_COMMIT }, |
{ 4, -1, OP_MARK }, |
| 210 |
{ 1, OP_FAIL }, |
{ 6, OP_ACCEPT, -1 }, |
| 211 |
{ 4, OP_FAIL }, |
{ 6, OP_COMMIT, -1 }, |
| 212 |
{ 5, OP_PRUNE }, |
{ 1, OP_FAIL, -1 }, |
| 213 |
{ 4, OP_SKIP }, |
{ 4, OP_FAIL, -1 }, |
| 214 |
{ 4, OP_THEN } |
{ 5, OP_PRUNE, OP_PRUNE_ARG }, |
| 215 |
|
{ 4, OP_SKIP, OP_SKIP_ARG }, |
| 216 |
|
{ 4, OP_THEN, OP_THEN_ARG } |
| 217 |
}; |
}; |
| 218 |
|
|
| 219 |
static const int verbcount = sizeof(verbs)/sizeof(verbitem); |
static const int verbcount = sizeof(verbs)/sizeof(verbitem); |
| 273 |
it is now one long string. We cannot use a table of offsets, because the |
it is now one long string. We cannot use a table of offsets, because the |
| 274 |
lengths of inserts such as XSTRING(MAX_NAME_SIZE) are not known. Instead, we |
lengths of inserts such as XSTRING(MAX_NAME_SIZE) are not known. Instead, we |
| 275 |
simply count through to the one we want - this isn't a performance issue |
simply count through to the one we want - this isn't a performance issue |
| 276 |
because these strings are used only when there is a compilation error. |
because these strings are used only when there is a compilation error. |
| 277 |
|
|
| 278 |
Each substring ends with \0 to insert a null character. This includes the final |
Each substring ends with \0 to insert a null character. This includes the final |
| 279 |
substring, so that the whole string ends with \0\0, which can be detected when |
substring, so that the whole string ends with \0\0, which can be detected when |
| 280 |
counting through. */ |
counting through. */ |
| 281 |
|
|
| 282 |
static const char error_texts[] = |
static const char error_texts[] = |
| 324 |
/* 35 */ |
/* 35 */ |
| 325 |
"invalid condition (?(0)\0" |
"invalid condition (?(0)\0" |
| 326 |
"\\C not allowed in lookbehind assertion\0" |
"\\C not allowed in lookbehind assertion\0" |
| 327 |
"PCRE does not support \\L, \\l, \\N, \\U, or \\u\0" |
"PCRE does not support \\L, \\l, \\N{name}, \\U, or \\u\0" |
| 328 |
"number after (?C is > 255\0" |
"number after (?C is > 255\0" |
| 329 |
"closing ) for (?C expected\0" |
"closing ) for (?C expected\0" |
| 330 |
/* 40 */ |
/* 40 */ |
| 350 |
"inconsistent NEWLINE options\0" |
"inconsistent NEWLINE options\0" |
| 351 |
"\\g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number\0" |
"\\g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number\0" |
| 352 |
"a numbered reference must not be zero\0" |
"a numbered reference must not be zero\0" |
| 353 |
"(*VERB) with an argument is not supported\0" |
"an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)\0" |
| 354 |
/* 60 */ |
/* 60 */ |
| 355 |
"(*VERB) not recognized\0" |
"(*VERB) not recognized\0" |
| 356 |
"number is too big\0" |
"number is too big\0" |
| 358 |
"digit expected after (?+\0" |
"digit expected after (?+\0" |
| 359 |
"] is an invalid data character in JavaScript compatibility mode\0" |
"] is an invalid data character in JavaScript compatibility mode\0" |
| 360 |
/* 65 */ |
/* 65 */ |
| 361 |
"different names for subpatterns of the same number are not allowed\0"; |
"different names for subpatterns of the same number are not allowed\0" |
| 362 |
|
"(*MARK) must have an argument\0" |
| 363 |
|
; |
| 364 |
|
|
| 365 |
/* Table to identify digits and hex digits. This is used when compiling |
/* Table to identify digits and hex digits. This is used when compiling |
| 366 |
patterns. Note that the tables in chartables are dependent on the locale, and |
patterns. Note that the tables in chartables are dependent on the locale, and |
| 518 |
find_error_text(int n) |
find_error_text(int n) |
| 519 |
{ |
{ |
| 520 |
const char *s = error_texts; |
const char *s = error_texts; |
| 521 |
for (; n > 0; n--) |
for (; n > 0; n--) |
| 522 |
{ |
{ |
| 523 |
while (*s++ != 0) {}; |
while (*s++ != 0) {}; |
| 524 |
if (*s == 0) return "Error text not found (please report)"; |
if (*s == 0) return "Error text not found (please report)"; |
| 525 |
} |
} |
| 526 |
return s; |
return s; |
| 527 |
} |
} |
| 528 |
|
|
| 593 |
|
|
| 594 |
case CHAR_l: |
case CHAR_l: |
| 595 |
case CHAR_L: |
case CHAR_L: |
|
case CHAR_N: |
|
| 596 |
case CHAR_u: |
case CHAR_u: |
| 597 |
case CHAR_U: |
case CHAR_U: |
| 598 |
*errorcodeptr = ERR37; |
*errorcodeptr = ERR37; |
| 829 |
break; |
break; |
| 830 |
} |
} |
| 831 |
} |
} |
| 832 |
|
|
| 833 |
|
/* Perl supports \N{name} for character names, as well as plain \N for "not |
| 834 |
|
newline". PCRE does not support \N{name}. */ |
| 835 |
|
|
| 836 |
|
if (c == -ESC_N && ptr[1] == CHAR_LEFT_CURLY_BRACKET) |
| 837 |
|
*errorcodeptr = ERR37; |
| 838 |
|
|
| 839 |
*ptrptr = ptr; |
*ptrptr = ptr; |
| 840 |
return c; |
return c; |
| 1467 |
case OP_CALLOUT: |
case OP_CALLOUT: |
| 1468 |
case OP_SOD: |
case OP_SOD: |
| 1469 |
case OP_SOM: |
case OP_SOM: |
| 1470 |
|
case OP_SET_SOM: |
| 1471 |
case OP_EOD: |
case OP_EOD: |
| 1472 |
case OP_EODN: |
case OP_EODN: |
| 1473 |
case OP_CIRC: |
case OP_CIRC: |
| 1627 |
|
|
| 1628 |
/* Otherwise, we can get the item's length from the table, except that for |
/* Otherwise, we can get the item's length from the table, except that for |
| 1629 |
repeated character types, we have to test for \p and \P, which have an extra |
repeated character types, we have to test for \p and \P, which have an extra |
| 1630 |
two bytes of parameters. */ |
two bytes of parameters, and for MARK/PRUNE/SKIP/THEN with an argument, we |
| 1631 |
|
must add in its length. */ |
| 1632 |
|
|
| 1633 |
else |
else |
| 1634 |
{ |
{ |
| 1652 |
case OP_TYPEPOSUPTO: |
case OP_TYPEPOSUPTO: |
| 1653 |
if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2; |
if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2; |
| 1654 |
break; |
break; |
| 1655 |
|
|
| 1656 |
|
case OP_MARK: |
| 1657 |
|
case OP_PRUNE_ARG: |
| 1658 |
|
case OP_SKIP_ARG: |
| 1659 |
|
case OP_THEN_ARG: |
| 1660 |
|
code += code[1]; |
| 1661 |
|
break; |
| 1662 |
} |
} |
| 1663 |
|
|
| 1664 |
/* Add in the fixed length from the table */ |
/* Add in the fixed length from the table */ |
| 1730 |
|
|
| 1731 |
/* Otherwise, we can get the item's length from the table, except that for |
/* Otherwise, we can get the item's length from the table, except that for |
| 1732 |
repeated character types, we have to test for \p and \P, which have an extra |
repeated character types, we have to test for \p and \P, which have an extra |
| 1733 |
two bytes of parameters. */ |
two bytes of parameters, and for MARK/PRUNE/SKIP/THEN with an argument, we |
| 1734 |
|
must add in its length. */ |
| 1735 |
|
|
| 1736 |
else |
else |
| 1737 |
{ |
{ |
| 1755 |
case OP_TYPEEXACT: |
case OP_TYPEEXACT: |
| 1756 |
if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2; |
if (code[3] == OP_PROP || code[3] == OP_NOTPROP) code += 2; |
| 1757 |
break; |
break; |
| 1758 |
|
|
| 1759 |
|
case OP_MARK: |
| 1760 |
|
case OP_PRUNE_ARG: |
| 1761 |
|
case OP_SKIP_ARG: |
| 1762 |
|
case OP_THEN_ARG: |
| 1763 |
|
code += code[1]; |
| 1764 |
|
break; |
| 1765 |
} |
} |
| 1766 |
|
|
| 1767 |
/* Add in the fixed length from the table */ |
/* Add in the fixed length from the table */ |
| 1818 |
code points to start of search |
code points to start of search |
| 1819 |
endcode points to where to stop |
endcode points to where to stop |
| 1820 |
utf8 TRUE if in UTF8 mode |
utf8 TRUE if in UTF8 mode |
| 1821 |
|
cd contains pointers to tables etc. |
| 1822 |
|
|
| 1823 |
Returns: TRUE if what is matched could be empty |
Returns: TRUE if what is matched could be empty |
| 1824 |
*/ |
*/ |
| 1825 |
|
|
| 1826 |
static BOOL |
static BOOL |
| 1827 |
could_be_empty_branch(const uschar *code, const uschar *endcode, BOOL utf8) |
could_be_empty_branch(const uschar *code, const uschar *endcode, BOOL utf8, |
| 1828 |
|
compile_data *cd) |
| 1829 |
{ |
{ |
| 1830 |
register int c; |
register int c; |
| 1831 |
for (code = first_significant_code(code + _pcre_OP_lengths[*code], NULL, 0, TRUE); |
for (code = first_significant_code(code + _pcre_OP_lengths[*code], NULL, 0, TRUE); |
| 1856 |
continue; |
continue; |
| 1857 |
} |
} |
| 1858 |
|
|
| 1859 |
|
/* For a recursion/subroutine call, if its end has been reached, which |
| 1860 |
|
implies a subroutine call, we can scan it. */ |
| 1861 |
|
|
| 1862 |
|
if (c == OP_RECURSE) |
| 1863 |
|
{ |
| 1864 |
|
BOOL empty_branch = FALSE; |
| 1865 |
|
const uschar *scode = cd->start_code + GET(code, 1); |
| 1866 |
|
if (GET(scode, 1) == 0) return TRUE; /* Unclosed */ |
| 1867 |
|
do |
| 1868 |
|
{ |
| 1869 |
|
if (could_be_empty_branch(scode, endcode, utf8, cd)) |
| 1870 |
|
{ |
| 1871 |
|
empty_branch = TRUE; |
| 1872 |
|
break; |
| 1873 |
|
} |
| 1874 |
|
scode += GET(scode, 1); |
| 1875 |
|
} |
| 1876 |
|
while (*scode == OP_ALT); |
| 1877 |
|
if (!empty_branch) return FALSE; /* All branches are non-empty */ |
| 1878 |
|
continue; |
| 1879 |
|
} |
| 1880 |
|
|
| 1881 |
/* For other groups, scan the branches. */ |
/* For other groups, scan the branches. */ |
| 1882 |
|
|
| 1883 |
if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE || c == OP_COND) |
if (c == OP_BRA || c == OP_CBRA || c == OP_ONCE || c == OP_COND) |
| 1896 |
empty_branch = FALSE; |
empty_branch = FALSE; |
| 1897 |
do |
do |
| 1898 |
{ |
{ |
| 1899 |
if (!empty_branch && could_be_empty_branch(code, endcode, utf8)) |
if (!empty_branch && could_be_empty_branch(code, endcode, utf8, cd)) |
| 1900 |
empty_branch = TRUE; |
empty_branch = TRUE; |
| 1901 |
code += GET(code, 1); |
code += GET(code, 1); |
| 1902 |
} |
} |
| 2030 |
if (utf8 && code[3] >= 0xc0) code += _pcre_utf8_table4[code[3] & 0x3f]; |
if (utf8 && code[3] >= 0xc0) code += _pcre_utf8_table4[code[3] & 0x3f]; |
| 2031 |
break; |
break; |
| 2032 |
#endif |
#endif |
| 2033 |
|
|
| 2034 |
|
/* MARK, and PRUNE/SKIP/THEN with an argument must skip over the argument |
| 2035 |
|
string. */ |
| 2036 |
|
|
| 2037 |
|
case OP_MARK: |
| 2038 |
|
case OP_PRUNE_ARG: |
| 2039 |
|
case OP_SKIP_ARG: |
| 2040 |
|
case OP_THEN_ARG: |
| 2041 |
|
code += code[1]; |
| 2042 |
|
break; |
| 2043 |
|
|
| 2044 |
|
/* None of the remaining opcodes are required to match a character. */ |
| 2045 |
|
|
| 2046 |
|
default: |
| 2047 |
|
break; |
| 2048 |
} |
} |
| 2049 |
} |
} |
| 2050 |
|
|
| 2067 |
endcode points to where to stop (current RECURSE item) |
endcode points to where to stop (current RECURSE item) |
| 2068 |
bcptr points to the chain of current (unclosed) branch starts |
bcptr points to the chain of current (unclosed) branch starts |
| 2069 |
utf8 TRUE if in UTF-8 mode |
utf8 TRUE if in UTF-8 mode |
| 2070 |
|
cd pointers to tables etc |
| 2071 |
|
|
| 2072 |
Returns: TRUE if what is matched could be empty |
Returns: TRUE if what is matched could be empty |
| 2073 |
*/ |
*/ |
| 2074 |
|
|
| 2075 |
static BOOL |
static BOOL |
| 2076 |
could_be_empty(const uschar *code, const uschar *endcode, branch_chain *bcptr, |
could_be_empty(const uschar *code, const uschar *endcode, branch_chain *bcptr, |
| 2077 |
BOOL utf8) |
BOOL utf8, compile_data *cd) |
| 2078 |
{ |
{ |
| 2079 |
while (bcptr != NULL && bcptr->current_branch >= code) |
while (bcptr != NULL && bcptr->current_branch >= code) |
| 2080 |
{ |
{ |
| 2081 |
if (!could_be_empty_branch(bcptr->current_branch, endcode, utf8)) |
if (!could_be_empty_branch(bcptr->current_branch, endcode, utf8, cd)) |
| 2082 |
return FALSE; |
return FALSE; |
| 2083 |
bcptr = bcptr->outer; |
bcptr = bcptr->outer; |
| 2084 |
} |
} |
| 2803 |
#ifdef PCRE_DEBUG |
#ifdef PCRE_DEBUG |
| 2804 |
if (code > cd->hwm) cd->hwm = code; /* High water info */ |
if (code > cd->hwm) cd->hwm = code; /* High water info */ |
| 2805 |
#endif |
#endif |
| 2806 |
if (code > cd->start_workspace + COMPILE_WORK_SIZE) /* Check for overrun */ |
if (code > cd->start_workspace + WORK_SIZE_CHECK) /* Check for overrun */ |
| 2807 |
{ |
{ |
| 2808 |
*errorcodeptr = ERR52; |
*errorcodeptr = ERR52; |
| 2809 |
goto FAILED; |
goto FAILED; |
| 2852 |
/* In the real compile phase, just check the workspace used by the forward |
/* In the real compile phase, just check the workspace used by the forward |
| 2853 |
reference list. */ |
reference list. */ |
| 2854 |
|
|
| 2855 |
else if (cd->hwm > cd->start_workspace + COMPILE_WORK_SIZE) |
else if (cd->hwm > cd->start_workspace + WORK_SIZE_CHECK) |
| 2856 |
{ |
{ |
| 2857 |
*errorcodeptr = ERR52; |
*errorcodeptr = ERR52; |
| 2858 |
goto FAILED; |
goto FAILED; |
| 3209 |
|
|
| 3210 |
/* Backslash may introduce a single character, or it may introduce one |
/* Backslash may introduce a single character, or it may introduce one |
| 3211 |
of the specials, which just set a flag. The sequence \b is a special |
of the specials, which just set a flag. The sequence \b is a special |
| 3212 |
case. Inside a class (and only there) it is treated as backspace. |
case. Inside a class (and only there) it is treated as backspace. We |
| 3213 |
Elsewhere it marks a word boundary. Other escapes have preset maps ready |
assume that other escapes have more than one character in them, so set |
| 3214 |
to 'or' into the one we are building. We assume they have more than one |
class_charcount bigger than one. Unrecognized escapes fall through and |
| 3215 |
character in them, so set class_charcount bigger than one. */ |
are either treated as literal characters (by default), or are faulted if |
| 3216 |
|
PCRE_EXTRA is set. */ |
| 3217 |
|
|
| 3218 |
if (c == CHAR_BACKSLASH) |
if (c == CHAR_BACKSLASH) |
| 3219 |
{ |
{ |
| 3220 |
c = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE); |
c = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE); |
| 3221 |
if (*errorcodeptr != 0) goto FAILED; |
if (*errorcodeptr != 0) goto FAILED; |
| 3222 |
|
|
| 3223 |
if (-c == ESC_b) c = CHAR_BS; /* \b is backspace in a class */ |
if (-c == ESC_b) c = CHAR_BS; /* \b is backspace in a class */ |
|
else if (-c == ESC_X) c = CHAR_X; /* \X is literal X in a class */ |
|
|
else if (-c == ESC_R) c = CHAR_R; /* \R is literal R in a class */ |
|
| 3224 |
else if (-c == ESC_Q) /* Handle start of quoted string */ |
else if (-c == ESC_Q) /* Handle start of quoted string */ |
| 3225 |
{ |
{ |
| 3226 |
if (ptr[1] == CHAR_BACKSLASH && ptr[2] == CHAR_E) |
if (ptr[1] == CHAR_BACKSLASH && ptr[2] == CHAR_E) |
| 3505 |
d = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE); |
d = check_escape(&ptr, errorcodeptr, cd->bracount, options, TRUE); |
| 3506 |
if (*errorcodeptr != 0) goto FAILED; |
if (*errorcodeptr != 0) goto FAILED; |
| 3507 |
|
|
| 3508 |
/* \b is backspace; \X is literal X; \R is literal R; any other |
/* \b is backspace; any other special means the '-' was literal */ |
|
special means the '-' was literal */ |
|
| 3509 |
|
|
| 3510 |
if (d < 0) |
if (d < 0) |
| 3511 |
{ |
{ |
| 3512 |
if (d == -ESC_b) d = CHAR_BS; |
if (d == -ESC_b) d = CHAR_BS; else |
|
else if (d == -ESC_X) d = CHAR_X; |
|
|
else if (d == -ESC_R) d = CHAR_R; else |
|
| 3513 |
{ |
{ |
| 3514 |
ptr = oldptr; |
ptr = oldptr; |
| 3515 |
goto LONE_SINGLE_CHARACTER; /* A few lines below */ |
goto LONE_SINGLE_CHARACTER; /* A few lines below */ |
| 4432 |
uschar *scode = bracode; |
uschar *scode = bracode; |
| 4433 |
do |
do |
| 4434 |
{ |
{ |
| 4435 |
if (could_be_empty_branch(scode, ketcode, utf8)) |
if (could_be_empty_branch(scode, ketcode, utf8, cd)) |
| 4436 |
{ |
{ |
| 4437 |
*bracode += OP_SBRA - OP_BRA; |
*bracode += OP_SBRA - OP_BRA; |
| 4438 |
break; |
break; |
| 4509 |
|
|
| 4510 |
/* Because we are moving code along, we must ensure that any |
/* Because we are moving code along, we must ensure that any |
| 4511 |
pending recursive references are updated. */ |
pending recursive references are updated. */ |
| 4512 |
|
|
| 4513 |
default: |
default: |
| 4514 |
*code = OP_END; |
*code = OP_END; |
| 4515 |
adjust_recurse(tempcode, 1 + LINK_SIZE, utf8, cd, save_hwm); |
adjust_recurse(tempcode, 1 + LINK_SIZE, utf8, cd, save_hwm); |
| 4548 |
|
|
| 4549 |
/* First deal with various "verbs" that can be introduced by '*'. */ |
/* First deal with various "verbs" that can be introduced by '*'. */ |
| 4550 |
|
|
| 4551 |
if (*(++ptr) == CHAR_ASTERISK && (cd->ctypes[ptr[1]] & ctype_letter) != 0) |
if (*(++ptr) == CHAR_ASTERISK && |
| 4552 |
|
((cd->ctypes[ptr[1]] & ctype_letter) != 0 || ptr[1] == ':')) |
| 4553 |
{ |
{ |
| 4554 |
int i, namelen; |
int i, namelen; |
| 4555 |
|
int arglen = 0; |
| 4556 |
const char *vn = verbnames; |
const char *vn = verbnames; |
| 4557 |
const uschar *name = ++ptr; |
const uschar *name = ptr + 1; |
| 4558 |
|
const uschar *arg = NULL; |
| 4559 |
previous = NULL; |
previous = NULL; |
| 4560 |
while ((cd->ctypes[*++ptr] & ctype_letter) != 0) {}; |
while ((cd->ctypes[*++ptr] & ctype_letter) != 0) {}; |
| 4561 |
|
namelen = ptr - name; |
| 4562 |
|
|
| 4563 |
if (*ptr == CHAR_COLON) |
if (*ptr == CHAR_COLON) |
| 4564 |
{ |
{ |
| 4565 |
*errorcodeptr = ERR59; /* Not supported */ |
arg = ++ptr; |
| 4566 |
goto FAILED; |
while ((cd->ctypes[*ptr] & (ctype_letter|ctype_digit)) != 0 |
| 4567 |
|
|| *ptr == '_') ptr++; |
| 4568 |
|
arglen = ptr - arg; |
| 4569 |
} |
} |
| 4570 |
|
|
| 4571 |
if (*ptr != CHAR_RIGHT_PARENTHESIS) |
if (*ptr != CHAR_RIGHT_PARENTHESIS) |
| 4572 |
{ |
{ |
| 4573 |
*errorcodeptr = ERR60; |
*errorcodeptr = ERR60; |
| 4574 |
goto FAILED; |
goto FAILED; |
| 4575 |
} |
} |
| 4576 |
namelen = ptr - name; |
|
| 4577 |
|
/* Scan the table of verb names */ |
| 4578 |
|
|
| 4579 |
for (i = 0; i < verbcount; i++) |
for (i = 0; i < verbcount; i++) |
| 4580 |
{ |
{ |
| 4581 |
if (namelen == verbs[i].len && |
if (namelen == verbs[i].len && |
| 4593 |
PUT2INC(code, 0, oc->number); |
PUT2INC(code, 0, oc->number); |
| 4594 |
} |
} |
| 4595 |
} |
} |
| 4596 |
*code++ = verbs[i].op; |
|
| 4597 |
break; |
/* Handle the cases with/without an argument */ |
| 4598 |
|
|
| 4599 |
|
if (arglen == 0) |
| 4600 |
|
{ |
| 4601 |
|
if (verbs[i].op < 0) /* Argument is mandatory */ |
| 4602 |
|
{ |
| 4603 |
|
*errorcodeptr = ERR66; |
| 4604 |
|
goto FAILED; |
| 4605 |
|
} |
| 4606 |
|
*code++ = verbs[i].op; |
| 4607 |
|
} |
| 4608 |
|
|
| 4609 |
|
else |
| 4610 |
|
{ |
| 4611 |
|
if (verbs[i].op_arg < 0) /* Argument is forbidden */ |
| 4612 |
|
{ |
| 4613 |
|
*errorcodeptr = ERR59; |
| 4614 |
|
goto FAILED; |
| 4615 |
|
} |
| 4616 |
|
*code++ = verbs[i].op_arg; |
| 4617 |
|
*code++ = arglen; |
| 4618 |
|
memcpy(code, arg, arglen); |
| 4619 |
|
code += arglen; |
| 4620 |
|
*code++ = 0; |
| 4621 |
|
} |
| 4622 |
|
|
| 4623 |
|
break; /* Found verb, exit loop */ |
| 4624 |
} |
} |
| 4625 |
|
|
| 4626 |
vn += verbs[i].len + 1; |
vn += verbs[i].len + 1; |
| 4627 |
} |
} |
| 4628 |
if (i < verbcount) continue; |
|
| 4629 |
*errorcodeptr = ERR60; |
if (i < verbcount) continue; /* Successfully handled a verb */ |
| 4630 |
|
*errorcodeptr = ERR60; /* Verb not recognized */ |
| 4631 |
goto FAILED; |
goto FAILED; |
| 4632 |
} |
} |
| 4633 |
|
|
| 5269 |
*errorcodeptr = ERR15; |
*errorcodeptr = ERR15; |
| 5270 |
goto FAILED; |
goto FAILED; |
| 5271 |
} |
} |
| 5272 |
|
|
| 5273 |
/* Fudge the value of "called" so that when it is inserted as an |
/* Fudge the value of "called" so that when it is inserted as an |
| 5274 |
offset below, what it actually inserted is the reference number |
offset below, what it actually inserted is the reference number |
| 5275 |
of the group. */ |
of the group. */ |
| 5276 |
|
|
| 5277 |
called = cd->start_code + recno; |
called = cd->start_code + recno; |
| 5278 |
PUTINC(cd->hwm, 0, code + 2 + LINK_SIZE - cd->start_code); |
PUTINC(cd->hwm, 0, code + 2 + LINK_SIZE - cd->start_code); |
| 5279 |
} |
} |
| 5283 |
recursion that could loop for ever, and diagnose that case. */ |
recursion that could loop for ever, and diagnose that case. */ |
| 5284 |
|
|
| 5285 |
else if (GET(called, 1) == 0 && |
else if (GET(called, 1) == 0 && |
| 5286 |
could_be_empty(called, code, bcptr, utf8)) |
could_be_empty(called, code, bcptr, utf8, cd)) |
| 5287 |
{ |
{ |
| 5288 |
*errorcodeptr = ERR40; |
*errorcodeptr = ERR40; |
| 5289 |
goto FAILED; |
goto FAILED; |
| 5410 |
} /* End of switch for character following (? */ |
} /* End of switch for character following (? */ |
| 5411 |
} /* End of (? handling */ |
} /* End of (? handling */ |
| 5412 |
|
|
| 5413 |
/* Opening parenthesis not followed by '?'. If PCRE_NO_AUTO_CAPTURE is set, |
/* Opening parenthesis not followed by '*' or '?'. If PCRE_NO_AUTO_CAPTURE |
| 5414 |
all unadorned brackets become non-capturing and behave like (?:...) |
is set, all unadorned brackets become non-capturing and behave like (?:...) |
| 5415 |
brackets. */ |
brackets. */ |
| 5416 |
|
|
| 5417 |
else if ((options & PCRE_NO_AUTO_CAPTURE) != 0) |
else if ((options & PCRE_NO_AUTO_CAPTURE) != 0) |