diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-06-07 23:41:32 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-06-08 00:14:12 -0700 |
commit | 94e7eb6fe4b29b1c1dbe5eb489b4bfae607d9350 (patch) | |
tree | 464009bb69598475557e8f87685282fe89e3033a /pp.c | |
parent | 6cda7db16df9c75aa4f97b02443762d11e9bc150 (diff) | |
download | perl-94e7eb6fe4b29b1c1dbe5eb489b4bfae607d9350.tar.gz |
[perl #117941] Handle vivification crashing w/freed stash
open’s handle vivification could crash if the current stash was freed,
so check before passing a freed stash to gv_init.
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -237,8 +237,10 @@ S_rv2gv(pTHX_ SV *sv, const bool vivify_sv, const bool strict, Perl_croak_no_modify(); if (cUNOP->op_targ) { SV * const namesv = PAD_SV(cUNOP->op_targ); + HV *stash = CopSTASH(PL_curcop); + if (SvTYPE(stash) != SVt_PVHV) stash = NULL; gv = MUTABLE_GV(newSV(0)); - gv_init_sv(gv, CopSTASH(PL_curcop), namesv, 0); + gv_init_sv(gv, stash, namesv, 0); } else { const char * const name = CopSTASHPV(PL_curcop); |