diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-12-06 08:34:15 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-12-06 08:34:15 -0800 |
commit | bbde7ba366f7e8eba62f86287e5267085c03d7dc (patch) | |
tree | 1ab08242972cda770004b9eaf694257ad59ae9a1 /pp_ctl.c | |
parent | 70eec6488881c54307a924829e648b8abc9e8bc7 (diff) | |
download | perl-bbde7ba366f7e8eba62f86287e5267085c03d7dc.tar.gz |
Don’t LEAVE_with_name("evalcomp") for syntax errors
In S_doeval, if yystatus == 0 but there have been parser errors, then
there will be an extra scope on the scope stack inside the evalcomp
scope, causing an assertion failure with LEAVE_with_name("evalcomp").
This can happen with eval(q|""!=!~//|), which is a reduced version of
an eval in SNMP::Trapinfo’s test suite.
Under non-debugging builds, everything would have worked anyway,
as the LEAVE_with_name("evalcomp") would have left the scope
inside evalcomp.
Since POPBLOCK pops away the savestack markers on the scope stack, it
is not actually necessary to do LEAVE_with_name("evalcomp") at all
when there is a syntax error.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3588,8 +3588,6 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq, HV *hh) yystatus = (!in_require && CATCH_GET) ? S_try_yyparse(aTHX_ GRAMPROG) : yyparse(GRAMPROG); - if (!startop && yystatus != 3) LEAVE_with_name("evalcomp"); - if (yystatus || PL_parser->error_count || !PL_eval_root) { SV **newsp; /* Used by POPBLOCK. */ PERL_CONTEXT *cx; @@ -3615,6 +3613,7 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq, HV *hh) POPEVAL(cx); namesv = cx->blk_eval.old_namesv; } + /* POPBLOCK renders LEAVE_with_name("evalcomp") unnecessary. */ LEAVE_with_name("eval"); /* pp_entereval knows about this LEAVE. */ } @@ -3654,6 +3653,7 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq, HV *hh) PUTBACK; return FALSE; } + else if (!startop) LEAVE_with_name("evalcomp"); CopLINE_set(&PL_compiling, 0); if (startop) { *startop = PL_eval_root; |