Merge pull request #22 from PhilipHazel/early_fail_fix
Fix incorrect detection of alternatives in first character search.
This commit is contained in:
commit
e7af7efaa1
|
@ -1,6 +1,12 @@
|
||||||
Change Log for PCRE2
|
Change Log for PCRE2
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
Version 10.39-RC1 xx-xxx-2021
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
1. Fix incorrect detection of alternatives in first character search.
|
||||||
|
|
||||||
|
|
||||||
Version 10.38 01-October-2021
|
Version 10.38 01-October-2021
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
|
|
@ -1251,10 +1251,13 @@ SLJIT_ASSERT(*cc == OP_ONCE || *cc == OP_BRA || *cc == OP_CBRA);
|
||||||
SLJIT_ASSERT(*cc != OP_CBRA || common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] != 0);
|
SLJIT_ASSERT(*cc != OP_CBRA || common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] != 0);
|
||||||
SLJIT_ASSERT(start < EARLY_FAIL_ENHANCE_MAX);
|
SLJIT_ASSERT(start < EARLY_FAIL_ENHANCE_MAX);
|
||||||
|
|
||||||
|
next_alt = cc + GET(cc, 1);
|
||||||
|
if (*next_alt == OP_ALT)
|
||||||
|
fast_forward_allowed = FALSE;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
count = start;
|
count = start;
|
||||||
next_alt = cc + GET(cc, 1);
|
|
||||||
cc += 1 + LINK_SIZE + ((*cc == OP_CBRA) ? IMM2_SIZE : 0);
|
cc += 1 + LINK_SIZE + ((*cc == OP_CBRA) ? IMM2_SIZE : 0);
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
|
@ -1512,7 +1515,7 @@ do
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if (fast_forward_allowed && *next_alt == OP_KET)
|
if (fast_forward_allowed)
|
||||||
{
|
{
|
||||||
common->fast_forward_bc_ptr = accelerated_start;
|
common->fast_forward_bc_ptr = accelerated_start;
|
||||||
common->private_data_ptrs[(accelerated_start + 1) - common->start] = ((*private_data_start) << 3) | type_skip;
|
common->private_data_ptrs[(accelerated_start + 1) - common->start] = ((*private_data_start) << 3) | type_skip;
|
||||||
|
@ -1562,8 +1565,8 @@ do
|
||||||
else if (result < count)
|
else if (result < count)
|
||||||
result = count;
|
result = count;
|
||||||
|
|
||||||
fast_forward_allowed = FALSE;
|
|
||||||
cc = next_alt;
|
cc = next_alt;
|
||||||
|
next_alt = cc + GET(cc, 1);
|
||||||
}
|
}
|
||||||
while (*cc == OP_ALT);
|
while (*cc == OP_ALT);
|
||||||
|
|
||||||
|
|
|
@ -352,6 +352,7 @@ static struct regression_test_case regression_test_cases[] = {
|
||||||
{ MU, A, 0, 0, ".[ab]?.", "xx" },
|
{ MU, A, 0, 0, ".[ab]?.", "xx" },
|
||||||
{ MU, A, 0, 0, "_[ab]+_*a", "_aa" },
|
{ MU, A, 0, 0, "_[ab]+_*a", "_aa" },
|
||||||
{ MU, A, 0, 0, "#(A+)#\\d+", "#A#A#0" },
|
{ MU, A, 0, 0, "#(A+)#\\d+", "#A#A#0" },
|
||||||
|
{ MU, A, 0, 0, "(?P<size>\\d+)m|M", "4M" },
|
||||||
|
|
||||||
/* Bracket repeats with limit. */
|
/* Bracket repeats with limit. */
|
||||||
{ MU, A, 0, 0, "(?:(ab){2}){5}M", "abababababababababababM" },
|
{ MU, A, 0, 0, "(?:(ab){2}){5}M", "abababababababababababM" },
|
||||||
|
|
Loading…
Reference in New Issue