In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/fcd130693a9e7a753f63a08691ff619ad91bf8eb?hp=6b3eaabc80276055f42321406b1ff927f364d64e>
- Log ----------------------------------------------------------------- commit fcd130693a9e7a753f63a08691ff619ad91bf8eb Author: Father Chrysostomos <[email protected]> Date: Tue May 10 14:14:40 2016 -0700 [perl #128106] Fix reset with non-globs reset with a string argument was assuming that anything in a stash would be a glob. It crashed on anything else. ----------------------------------------------------------------------- Summary of changes: sv.c | 2 ++ t/op/reset.t | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sv.c b/sv.c index c383cbe..ec48e47 100644 --- a/sv.c +++ b/sv.c @@ -9712,6 +9712,8 @@ Perl_sv_resetpvn(pTHX_ const char *s, STRLEN len, HV * const stash) if (!todo[(U8)*HeKEY(entry)]) continue; gv = MUTABLE_GV(HeVAL(entry)); + if (!isGV(gv)) + continue; sv = GvSV(gv); if (sv && !SvREADONLY(sv)) { SV_CHECK_THINKFIRST_COW_DROP(sv); diff --git a/t/op/reset.t b/t/op/reset.t index db82309..227c84a 100644 --- a/t/op/reset.t +++ b/t/op/reset.t @@ -7,7 +7,7 @@ BEGIN { } use strict; -plan tests => 39; +plan tests => 40; package aiieee; @@ -140,6 +140,16 @@ for our $z (*_) { is $z, "*main::_", 'And the glob still has the right value'; } +package _128106 { + # Crash on non-globs in the stash. + sub u; # stub without proto + sub v($); # proto stub + sub w{}; # as of 5.22, $::{w} == \&w + $::{x} = undef; + reset 'u-x'; + ::ok (1, "no crash on non-globs in the stash"); +} + # This used to crash under threaded builds, because pmops were remembering # their stashes by name, rather than by pointer. fresh_perl_is( # it crashes more reliably with a smaller script -- Perl5 Master Repository
