summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-10-27 05:52:09 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-10-28 16:15:08 -0700
commit4639d557ab77c475c9938688efe6b61bedcecf8b (patch)
treed83a6af6329a191f657806a0b4c1054d08b09583 /perl.c
parentd456e3f4aa9f137527feb9abf07e9111b6205786 (diff)
downloadperl-4639d557ab77c475c9938688efe6b61bedcecf8b.tar.gz
Make PL_hintgv refcounted
Otherwise one can free it (by deleting the *^H glob) and cause a crash: $ perl -e 'delete $::{"\cH"}; ${^OPEN}=foo' Segmentation fault: 11 That happens because PL_hintgv points to a freed scalar, and GvHV(PL_hintgv) ends up trying to access nonexistent fields.
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index 355d4dd1a5..1361f58277 100644
--- a/perl.c
+++ b/perl.c
@@ -3715,6 +3715,7 @@ S_init_main_stash(pTHX)
SvREFCNT_inc_simple_void(PL_incgv); /* Don't allow it to be freed */
GvMULTI_on(PL_incgv);
PL_hintgv = gv_fetchpvs("\010", GV_ADD|GV_NOTQUAL, SVt_PV); /* ^H */
+ SvREFCNT_inc_simple_void(PL_hintgv);
GvMULTI_on(PL_hintgv);
PL_defgv = gv_fetchpvs("_", GV_ADD|GV_NOTQUAL, SVt_PVAV);
SvREFCNT_inc_simple_void(PL_defgv);