| 70 |
startcode pointer to start of the whole pattern |
startcode pointer to start of the whole pattern |
| 71 |
options the compiling options |
options the compiling options |
| 72 |
had_accept pointer to flag for (*ACCEPT) encountered |
had_accept pointer to flag for (*ACCEPT) encountered |
| 73 |
int RECURSE depth |
int RECURSE depth |
| 74 |
|
|
| 75 |
Returns: the minimum length |
Returns: the minimum length |
| 76 |
-1 if \C was encountered |
-1 if \C was encountered |
| 131 |
d = find_minlength(cc, startcode, options, had_accept_ptr, recurse_depth); |
d = find_minlength(cc, startcode, options, had_accept_ptr, recurse_depth); |
| 132 |
if (d < 0) return d; |
if (d < 0) return d; |
| 133 |
branchlength += d; |
branchlength += d; |
| 134 |
if (*had_accept_ptr) return branchlength; |
if (*had_accept_ptr) return branchlength; |
| 135 |
do cc += GET(cc, 1); while (*cc == OP_ALT); |
do cc += GET(cc, 1); while (*cc == OP_ALT); |
| 136 |
cc += 1 + LINK_SIZE; |
cc += 1 + LINK_SIZE; |
| 137 |
break; |
break; |
| 142 |
ACCEPT, it is essentially the same as END, but we set a flag so that |
ACCEPT, it is essentially the same as END, but we set a flag so that |
| 143 |
counting stops. */ |
counting stops. */ |
| 144 |
|
|
| 145 |
case OP_ACCEPT: |
case OP_ACCEPT: |
| 146 |
case OP_ASSERT_ACCEPT: |
case OP_ASSERT_ACCEPT: |
| 147 |
*had_accept_ptr = TRUE; |
*had_accept_ptr = TRUE; |
| 148 |
/* Fall through */ |
/* Fall through */ |
| 149 |
case OP_ALT: |
case OP_ALT: |
| 150 |
case OP_KET: |
case OP_KET: |
| 151 |
case OP_KETRMAX: |
case OP_KETRMAX: |
| 277 |
cc++; |
cc++; |
| 278 |
break; |
break; |
| 279 |
|
|
| 280 |
/* "Any newline" might match two characters, but it also might match just |
/* "Any newline" might match two characters, but it also might match just |
| 281 |
one. */ |
one. */ |
| 282 |
|
|
| 283 |
case OP_ANYNL: |
case OP_ANYNL: |
| 377 |
d = 0; |
d = 0; |
| 378 |
had_recurse = TRUE; |
had_recurse = TRUE; |
| 379 |
} |
} |
| 380 |
else |
else |
| 381 |
{ |
{ |
| 382 |
d = find_minlength(cs, startcode, options, had_accept_ptr, |
d = find_minlength(cs, startcode, options, had_accept_ptr, |
| 383 |
recurse_depth); |
recurse_depth); |
| 384 |
*had_accept_ptr = FALSE; |
*had_accept_ptr = FALSE; |
| 385 |
} |
} |
| 386 |
} |
} |
| 387 |
else d = 0; |
else d = 0; |
| 388 |
cc += 3; |
cc += 3; |
| 418 |
|
|
| 419 |
branchlength += min * d; |
branchlength += min * d; |
| 420 |
break; |
break; |
| 421 |
|
|
| 422 |
/* We can easily detect direct recursion, but not mutual recursion. This is |
/* We can easily detect direct recursion, but not mutual recursion. This is |
| 423 |
caught by a recursion depth count. */ |
caught by a recursion depth count. */ |
| 424 |
|
|
| 425 |
case OP_RECURSE: |
case OP_RECURSE: |
| 426 |
cs = ce = (uschar *)startcode + GET(cc, 1); |
cs = ce = (uschar *)startcode + GET(cc, 1); |
| 429 |
if ((cc > cs && cc < ce) || recurse_depth > 10) |
if ((cc > cs && cc < ce) || recurse_depth > 10) |
| 430 |
had_recurse = TRUE; |
had_recurse = TRUE; |
| 431 |
else |
else |
| 432 |
{ |
{ |
| 433 |
branchlength += find_minlength(cs, startcode, options, had_accept_ptr, |
branchlength += find_minlength(cs, startcode, options, had_accept_ptr, |
| 434 |
recurse_depth + 1); |
recurse_depth + 1); |
| 435 |
*had_accept_ptr = FALSE; |
*had_accept_ptr = FALSE; |
| 436 |
} |
} |
| 437 |
cc += 1 + LINK_SIZE; |
cc += 1 + LINK_SIZE; |
| 438 |
break; |
break; |
| 439 |
|
|
| 501 |
case OP_THEN_ARG: |
case OP_THEN_ARG: |
| 502 |
cc += _pcre_OP_lengths[op] + cc[1+LINK_SIZE]; |
cc += _pcre_OP_lengths[op] + cc[1+LINK_SIZE]; |
| 503 |
break; |
break; |
| 504 |
|
|
| 505 |
/* The remaining opcodes are just skipped over. */ |
/* The remaining opcodes are just skipped over. */ |
| 506 |
|
|
| 507 |
case OP_CLOSE: |
case OP_CLOSE: |
| 722 |
/* Fail for a valid opcode that implies no starting bits. */ |
/* Fail for a valid opcode that implies no starting bits. */ |
| 723 |
|
|
| 724 |
case OP_ACCEPT: |
case OP_ACCEPT: |
| 725 |
case OP_ASSERT_ACCEPT: |
case OP_ASSERT_ACCEPT: |
| 726 |
case OP_ALLANY: |
case OP_ALLANY: |
| 727 |
case OP_ANY: |
case OP_ANY: |
| 728 |
case OP_ANYBYTE: |
case OP_ANYBYTE: |
| 729 |
case OP_CIRC: |
case OP_CIRC: |
| 730 |
case OP_CIRCM: |
case OP_CIRCM: |
| 731 |
case OP_CLOSE: |
case OP_CLOSE: |
| 732 |
case OP_COMMIT: |
case OP_COMMIT: |
| 733 |
case OP_COND: |
case OP_COND: |
| 734 |
case OP_CREF: |
case OP_CREF: |
| 735 |
case OP_DEF: |
case OP_DEF: |
| 736 |
case OP_DOLL: |
case OP_DOLL: |
| 737 |
case OP_DOLLM: |
case OP_DOLLM: |
| 738 |
case OP_END: |
case OP_END: |
| 739 |
case OP_EOD: |
case OP_EOD: |
| 740 |
case OP_EODN: |
case OP_EODN: |
| 741 |
case OP_EXTUNI: |
case OP_EXTUNI: |
| 742 |
case OP_FAIL: |
case OP_FAIL: |
| 743 |
case OP_MARK: |
case OP_MARK: |
| 745 |
case OP_NOT: |
case OP_NOT: |
| 746 |
case OP_NOTEXACT: |
case OP_NOTEXACT: |
| 747 |
case OP_NOTEXACTI: |
case OP_NOTEXACTI: |
| 748 |
case OP_NOTI: |
case OP_NOTI: |
| 749 |
case OP_NOTMINPLUS: |
case OP_NOTMINPLUS: |
| 750 |
case OP_NOTMINPLUSI: |
case OP_NOTMINPLUSI: |
| 751 |
case OP_NOTMINQUERY: |
case OP_NOTMINQUERY: |
| 783 |
case OP_REFI: |
case OP_REFI: |
| 784 |
case OP_REVERSE: |
case OP_REVERSE: |
| 785 |
case OP_RREF: |
case OP_RREF: |
| 786 |
case OP_SCOND: |
case OP_SCOND: |
| 787 |
case OP_SET_SOM: |
case OP_SET_SOM: |
| 788 |
case OP_SKIP: |
case OP_SKIP: |
| 789 |
case OP_SKIP_ARG: |
case OP_SKIP_ARG: |
| 1160 |
for (c = 0; c < 32; c++) start_bits[c] |= tcode[c]; |
for (c = 0; c < 32; c++) start_bits[c] |= tcode[c]; |
| 1161 |
} |
} |
| 1162 |
|
|
| 1163 |
/* Advance past the bit map, and act on what follows. For a zero |
/* Advance past the bit map, and act on what follows. For a zero |
| 1164 |
minimum repeat, continue; otherwise stop processing. */ |
minimum repeat, continue; otherwise stop processing. */ |
| 1165 |
|
|
| 1166 |
tcode += 32; |
tcode += 32; |
| 1178 |
if (((tcode[1] << 8) + tcode[2]) == 0) tcode += 5; |
if (((tcode[1] << 8) + tcode[2]) == 0) tcode += 5; |
| 1179 |
else try_next = FALSE; |
else try_next = FALSE; |
| 1180 |
break; |
break; |
| 1181 |
|
|
| 1182 |
default: |
default: |
| 1183 |
try_next = FALSE; |
try_next = FALSE; |
| 1184 |
break; |
break; |