summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-11-19 23:02:31 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-11-19 23:02:31 +0000
commit39aa8287bdfc9ec0aeb8d8ace09b665ef71c53a8 (patch)
tree2d57a6a4f9e0b1df19c820d860874fae3c233148 /op.c
parent61de9fb5aad39c2904a43125c7c70031be6bc679 (diff)
downloadperl-39aa8287bdfc9ec0aeb8d8ace09b665ef71c53a8.tar.gz
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
Diffstat (limited to 'op.c')
-rw-r--r--op.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/op.c b/op.c
index 9f9722722f..c3aee1e68b 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;