This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't try to compile a pattern known to be in error
Regular expression patterns are parsed by the lexer/toker, and then
compiled by the regex compiler. It is foolish to try to compile one
that the parser has rejected as syntactically bad; assumptions may be
violated and segfaults ensue. This commit abandons all parsing
immediately if a pattern had errors in it. A better solution would be
to flag this pattern as not to be compiled, and continue parsing other
things so as to find the most errors in a single attempt, but I don't
think it's worth the extra effort.
Making this change caused some misleading error messages in the test
suite to be replaced by better ones.