diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-01-18 19:16:55 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-01-18 21:29:02 -0800 |
commit | bfa371b621d09f1ad1e588c4feaaadf9f20dc1c9 (patch) | |
tree | ec84f892d7c6792ff958a56580c107835ad4a520 /t/op/goto.t | |
parent | f60e676307b23b6eadcbba505b4f71838fe212a2 (diff) | |
download | perl-bfa371b621d09f1ad1e588c4feaaadf9f20dc1c9.tar.gz |
[perl #119949] Stop undef *_, goto &sub from crashing
Commit 049bd5ffd62b fixed problems with the wrong @_ being visible
after *_ modification followed by goto. In so doing, it made it
possible for a null to be placed at the start of the target sub’s
pad, because it was not checking that the array it got from PL_defgv
was actually non-null. Simply adding the check makes everything work.
Diffstat (limited to 't/op/goto.t')
-rw-r--r-- | t/op/goto.t | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/t/op/goto.t b/t/op/goto.t index 5c96f8ba5e..13e6b042ab 100644 --- a/t/op/goto.t +++ b/t/op/goto.t @@ -10,7 +10,7 @@ BEGIN { use warnings; use strict; -plan tests => 92; +plan tests => 94; our $TODO; my $deprecated = 0; @@ -498,6 +498,23 @@ eval { & { sub { goto &utf8::encode } } }; # *_{ARRAY} was untouched, too. is *_{ARRAY}, undef, 'goto &xsub when @_ does not exist'; +# goto &perlsub when @_ itself does not exist [perl #119949] +# This was only crashing when the replaced sub call had an argument list. +# (I.e., &{ sub { goto ... } } did not crash.) +sub { + undef *_; + goto sub { + is *_{ARRAY}, undef, 'goto &perlsub when @_ does not exist'; + } +}->(); +sub { + local *_; + goto sub { + is *_{ARRAY}, undef, 'goto &sub when @_ does not exist (local *_)'; + } +}->(); + + # [perl #36521] goto &foo in warn handler could defeat recursion avoider { |