* trietype so we can turn them into a trie. If/when we
* allow NOTHING to start a trie sequence this condition will be
* required, and it isn't expensive so we leave it in for now. */
- if ( trietype != NOTHING )
+ if ( trietype && trietype != NOTHING )
make_trie( pRExC_state,
startbranch, first, cur, tail, count,
trietype, depth+1 );
"", SvPV_nolen_const( mysv ),REG_NODE_NUM(cur));
});
- if ( last ) {
+ if ( last && trietype ) {
if ( trietype != NOTHING ) {
/* the last branch of the sequence was part of a trie,
* so we have to construct it here outside of the loop
}
-plan tests => 2521; # Update this when adding/deleting tests.
+plan tests => 2525; # Update this when adding/deleting tests.
run_tests() unless caller;
EOP
}
+ {
+ # pattern must be compiled late or we can break the test file
+ my $message = '[perl #115050] repeated nothings in a trie can cause panic';
+ my $pattern;
+ $pattern = '[xyz]|||';
+ ok("blah blah" =~ /$pattern/, $message);
+ ok("blah blah" =~ /(?:$pattern)h/, $message);
+ $pattern = '|||[xyz]';
+ ok("blah blah" =~ /$pattern/, $message);
+ ok("blah blah" =~ /(?:$pattern)h/, $message);
+ }
} # End of sub run_tests
1;