This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #125541] Fix crash with %::=(); J->${\"::"}
authorFather Chrysostomos <sprout@cpan.org>
Mon, 20 Jul 2015 18:23:49 +0000 (11:23 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 24 Jul 2015 12:56:57 +0000 (05:56 -0700)
commitd2fcb1d6773910aef058d59681ff6ae649f68352
tree38e83a66ce01ba7359bb029817041b80c9e5f9cd
parent56022c66b16bfc6b3aa117972e6ebb4c3acb03f7
[perl #125541] Fix crash with %::=(); J->${\"::"}

gv_stashpvn does not expect gv_fetchpv to return something that is
not a GV.  If someone has blown away the stash with %::=(), then the
$::{"main::"} entry no longer exists, but gv_fetchpv expects it to be
there.  This patch just makes this case fail somewhat gracefully
instead of crashing:

$  ./miniperl -e '%::=(); J->${\"::"}'
Can't locate object method "" via package "" (perhaps you forgot to load ""?) at -e line 1.

If someone does %::=(), nothing more reasonable should be expected.
At least it does not crash now.
gv.c