Skip to content

Commit

Permalink
[perl #72590] Panic if 'use strict' and forget 'my'
Browse files Browse the repository at this point in the history
That bug happens when we detect a compilation error in the statement
being parsed, and when the continuation of the parsing of that same
statement needs to load the file unicore/Name.pl via charnames.pm.
In that case perl gets confused, fails to parse Name.pl because
the parser is already in error, and also fails to properly rewind
to a normal error-reporting state.

This patch does not attempt to fix the whole error-reporting process;
instead, it simply prevents perl from trying to load charnames if it has
already recorded a parse error. So, in a way, it hides the bug under
the carpet. However, this is a safe fix, suitable for a code-freeze
stage.
  • Loading branch information
rgs committed Feb 11, 2010
1 parent 482d21b commit 78c4a74
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions regcomp.c
Expand Up @@ -6722,6 +6722,9 @@ S_reg_namedseq(pTHX_ RExC_state_t *pRExC_state, UV *valuep, I32 *flagp)
if ( he_str ) {
sv_str = HeVAL(he_str);
cached = 1;
} else if (PL_parser && PL_parser->error_count > 0) {
/* Don't attempt to load charnames if we're already in error */
vFAIL("Too many errors, cannot continue parsing");
} else {
dSP ;

Expand Down

0 comments on commit 78c4a74

Please sign in to comment.