From: Rafael Garcia-Suarez Date: Tue, 19 Nov 2002 23:02:31 +0000 (+0000) Subject: Fix perl bug #17920 : a case of parser coredump. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=39aa8287bdfc9ec0aeb8d8ace09b665ef71c53a8;p=p5sagit%2Fp5-mst-13.2.git Fix perl bug #17920 : a case of parser coredump. The fix is to disable Perl_block_start and Perl_block_end when the yacc parser has encountered errors. This prevents corruption of the internal stack, at the expense of correctness, but this doesn't matter as the code is unparseable anyway. p4raw-id: //depot/perl@18166 --- diff --git a/op.c b/op.c index 9f97227..c3aee1e 100644 --- a/op.c +++ b/op.c @@ -1734,6 +1734,8 @@ int Perl_block_start(pTHX_ int full) { int retval = PL_savestack_ix; + /* If there were syntax errors, don't try to start a block */ + if (PL_yynerrs) return retval; pad_block_start(full); SAVEHINTS(); @@ -1757,6 +1759,8 @@ Perl_block_end(pTHX_ I32 floor, OP *seq) int needblockscope = PL_hints & HINT_BLOCK_SCOPE; line_t copline = PL_copline; OP* retval = scalarseq(seq); + /* If there were syntax errors, don't try to close a block */ + if (PL_yynerrs) return retval; if (!seq) { /* scalarseq() gave us an OP_STUB */ retval->op_flags |= OPf_PARENS;