Skip to content

study_chunk: do not rewrite for trie while enframed #17714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4804,9 +4804,10 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
}
}

if (PERL_ENABLE_TRIE_OPTIMISATION &&
OP( startbranch ) == BRANCH )
{
if (PERL_ENABLE_TRIE_OPTIMISATION
&& OP(startbranch) == BRANCH
&& !frame
) {
/* demq.

Assuming this was/is a branch we are dealing with: 'scan'
Expand Down
9 changes: 8 additions & 1 deletion t/re/pat.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BEGIN {

skip_all_without_unicode_tables();

plan tests => 1017; # Update this when adding/deleting tests.
plan tests => 1018; # Update this when adding/deleting tests.

run_tests() unless caller;

Expand Down Expand Up @@ -2252,6 +2252,13 @@ SKIP:
ok($result, "regexp correctly matched");
}

# gh16947: test regexp corruption
{
fresh_perl_is(q{
'xy' =~ /x(?0)|x(?|y|y)/ && print 'ok'
}, 'ok', {}, 'gh16947: test regexp corruption');
}

} # End of sub run_tests

1;
Expand Down