diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-10-27 05:52:09 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-10-28 16:15:08 -0700 |
commit | 4639d557ab77c475c9938688efe6b61bedcecf8b (patch) | |
tree | d83a6af6329a191f657806a0b4c1054d08b09583 /perl.c | |
parent | d456e3f4aa9f137527feb9abf07e9111b6205786 (diff) | |
download | perl-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.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -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); |