summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-06-07 23:41:32 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-06-08 00:14:12 -0700
commit94e7eb6fe4b29b1c1dbe5eb489b4bfae607d9350 (patch)
tree464009bb69598475557e8f87685282fe89e3033a /pp.c
parent6cda7db16df9c75aa4f97b02443762d11e9bc150 (diff)
downloadperl-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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index 3eb3cea6af..0367023506 100644
--- a/pp.c
+++ b/pp.c
@@ -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);