diff options
author | Father Chrysostomos <sprout@cpan.org> | 2017-04-07 14:08:02 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2017-06-01 06:34:59 -0700 |
commit | 790acddeaa0d2c73524596048b129561225cf100 (patch) | |
tree | 3262a6dd2a3b07b34e1440b3c48cf0bceaf8b43b /gv.c | |
parent | dddb22758b5060ae9de978fbb03317185af97b24 (diff) | |
download | perl-790acddeaa0d2c73524596048b129561225cf100.tar.gz |
[perl #131085] Crash with sub-in-stash
$ perl -e '$::{"A"} = sub {}; \&{"A"}'
Segmentation fault (core dumped)
The code that vivifies a typeglob out of a code ref assumed that the
CV had a name hek, which is always the case when perl itself puts the
code ref there (via ‘sub A{}’), but is not necessarily the case if
someone is insinuating other stuff into the stash.
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -421,7 +421,7 @@ Perl_gv_init_pvn(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, U32 flag /* Not actually a constant. Just a regular sub. */ CV * const cv = (CV *)has_constant; GvCV_set(gv,cv); - if (CvSTASH(cv) == stash && ( + if (CvNAMED(cv) && CvSTASH(cv) == stash && ( CvNAME_HEK(cv) == GvNAME_HEK(gv) || ( HEK_LEN(CvNAME_HEK(cv)) == HEK_LEN(GvNAME_HEK(gv)) && HEK_FLAGS(CvNAME_HEK(cv)) != HEK_FLAGS(GvNAME_HEK(gv)) |