In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/ce7c414ee71d82955c799dca38981337cdf77b42?hp=57db463f603fcd67bf53a35aa482bb24aa2c6950>
- Log ----------------------------------------------------------------- commit ce7c414ee71d82955c799dca38981337cdf77b42 Author: Father Chrysostomos <[email protected]> Date: Sun Mar 1 18:11:23 2015 -0800 [perl #123955] Fix assert fail with 0 s/// in quotes This is related to bug #123617 and is a follow-up to eabab8bcc. This code: "@0{0s 000";eval"$" begins tokenisation as follows: stringify ( join ( $ " , @ 0 { 0 subst When seeing the subst after the 0, the parser discards many tokens and we end up at the ; outside the quotes. Since PL_lex_stuff (the temporary spot for storing the contents of a quote-like operator) is localised as of eabab8bcc, we end up with just PL_sublex_info.repl (the temporary spot for storing the replacement part) set. Since it is still set when we get to the next double- quote, it is treated as a two-part quote-like operator, like y or s. That canât happen, and we have assertions to make sure of it. We need to localise PL_sublex_info.repl as well, so it gets freed properly when scopes are popped after an error. ----------------------------------------------------------------------- Summary of changes: t/base/lex.t | 3 ++- toke.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/t/base/lex.t b/t/base/lex.t index fdeafb1..6a8ac61 100644 --- a/t/base/lex.t +++ b/t/base/lex.t @@ -486,8 +486,9 @@ print "ok $test - map{sub :lvalue...}\n"; $test++; # Used to crash [perl #123711] 0-5x-l{0}; -# Used to fail an assertion [perl #123617] +# Used to fail an assertion [perl #123617] [perl #123955] eval '"$a{ 1 m// }"; //'; +eval '"@0{0s 000";eval"$"'; # Pending token stack overflow [perl #123677] { diff --git a/toke.c b/toke.c index f7ad00d..0eeafd4 100644 --- a/toke.c +++ b/toke.c @@ -2381,6 +2381,7 @@ S_sublex_push(pTHX) popping. We must not have a PL_lex_stuff value left dangling, as that breaks assumptions elsewhere. See bug #123617. */ SAVEGENERICSV(PL_lex_stuff); + SAVEGENERICSV(PL_sublex_info.repl); PL_bufend = PL_bufptr = PL_oldbufptr = PL_oldoldbufptr = PL_linestart = SvPVX(PL_linestr); -- Perl5 Master Repository
