diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2005-07-17 20:12:54 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2005-07-17 20:12:54 +0000 |
commit | c5be5b4d0dbe0afabce77a95841bf101893b1571 (patch) | |
tree | fd5a6d7adfdf92eec1e2f3b2eaccc1f9c3dc2ff9 | |
parent | ce44635a98097a8f9f8acc0fc8393ebd5524dbdf (diff) | |
download | perl-c5be5b4d0dbe0afabce77a95841bf101893b1571.tar.gz |
$SIG{__WARN__} = sub { goto &foo } could recurse infinitely
p4raw-id: //depot/perl@25160
-rwxr-xr-x | t/op/goto.t | 12 | ||||
-rw-r--r-- | util.c | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/t/op/goto.t b/t/op/goto.t index 7f502bd806..082a165574 100755 --- a/t/op/goto.t +++ b/t/op/goto.t @@ -10,7 +10,7 @@ BEGIN { use warnings; use strict; -plan tests => 56; +plan tests => 57; our $foo; while ($?) { @@ -436,3 +436,13 @@ eval 'goto &null'; like($@, qr/Can't goto subroutine from an eval-string/, 'eval string'); eval { goto &null }; like($@, qr/Can't goto subroutine from an eval-block/, 'eval block'); + +# [perl #36521] goto &foo in warn handler could defeat recursion avoider + +{ + my $r = runperl( + stderr => 1, + prog => 'my $d; my $w = sub { return if $d++; warn q(bar)}; local $SIG{__WARN__} = sub { goto &$w; }; warn q(foo);' + ); + like($r, qr/bar/, "goto &foo in warn"); +} @@ -1278,6 +1278,8 @@ Perl_vwarn(pTHX_ const char* pat, va_list *args) SV *msg; ENTER; + SAVESPTR(PL_warnhook); + PL_warnhook = Nullsv; save_re_context(); msg = newSVpvn(message, msglen); SvFLAGS(msg) |= utf8; |