File tree 2 files changed +13
-1
lines changed 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ BEGIN {
10
10
11
11
use warnings;
12
12
use strict;
13
- plan tests => 56 ;
13
+ plan tests => 57 ;
14
14
15
15
our $foo ;
16
16
while ($? ) {
@@ -436,3 +436,13 @@ eval 'goto &null';
436
436
like($@ , qr / Can't goto subroutine from an eval-string/ , ' eval string' );
437
437
eval { goto &null };
438
438
like($@ , qr / Can't goto subroutine from an eval-block/ , ' eval block' );
439
+
440
+ # [perl #36521] goto &foo in warn handler could defeat recursion avoider
441
+
442
+ {
443
+ my $r = runperl(
444
+ stderr => 1,
445
+ prog => ' my $d; my $w = sub { return if $d++; warn q(bar)}; local $SIG{__WARN__} = sub { goto &$w; }; warn q(foo);'
446
+ );
447
+ like($r , qr / bar/ , " goto &foo in warn" );
448
+ }
Original file line number Diff line number Diff line change @@ -1278,6 +1278,8 @@ Perl_vwarn(pTHX_ const char* pat, va_list *args)
1278
1278
SV * msg ;
1279
1279
1280
1280
ENTER ;
1281
+ SAVESPTR (PL_warnhook );
1282
+ PL_warnhook = Nullsv ;
1281
1283
save_re_context ();
1282
1284
msg = newSVpvn (message , msglen );
1283
1285
SvFLAGS (msg ) |= utf8 ;
You can’t perform that action at this time.
0 commit comments