This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec.c: fix #129903: forbid empty pattern in regex code block
PL_curpm provides access to the data needed to implement
the regex magic vars like $1 and $&. These vars are defined
to reference the last successfully matched pattern, or when
in regex code blocks (?{ ... }) and (??{ ... }), they
should refer to the currently executing pattern.
Unfortunately this collides with its use to implement the
empty pattern special behavior, which requires /just/
"the last successfully matched pattern" everwhere.
This meant that a pattern match like /(?{ s!!! })/ will
infinitely recurse. Fixing this would be difficult, on
the other hand detecting it is not, so we can convert
the infinite recursion/stack overflow into a normal
exception.