$ perl5.18.1 -e '$Foo::{"Bar::"} = 0; $Bar::Bar::; *Bar:: = *Foo::'
Segmentation fault: 11
That $Foo::{"Bar::"} = 0; assignment is documented as having unde-
fined behaviour, but it shouldn’t crash.
if(
(
- stashentry && *stashentry
+ stashentry && *stashentry && isGV(*stashentry)
&& (substash = GvHV(*stashentry))
)
|| (oldsubstash && HvENAME_get(oldsubstash))
use strict;
use warnings;
-plan(tests => 53);
+plan(tests => 54);
{
package New;
no warnings;
is 'Bazo'->ber, 'black sheep', 'localised *glob=$stashref assignment';
}
+
+# $Stash::{"entries::"} that are not globs.
+# These used to crash.
+$NotGlob::{"NotGlob::"} = 0; () = $NewNotGlob::NotGlob::;
+*NewNotGlob:: = *NotGlob::;
+pass(
+ "no crash when clobbering sub-'stash' whose parent stash entry is no GV"
+);