Skip to content

Commit a28a6c1

Browse files
committed
add tests for #21661
1 parent cf76a26 commit a28a6c1

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

t/re/pat.t

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ skip_all_without_unicode_tables();
2828
my $has_locales = locales_enabled('LC_CTYPE');
2929
my $utf8_locale = find_utf8_ctype_locale();
3030

31-
plan tests => 1265; # Update this when adding/deleting tests.
31+
plan tests => 1267; # Update this when adding/deleting tests.
3232

3333
run_tests() unless caller;
3434

@@ -2512,6 +2512,22 @@ SKIP:
25122512
ok($str =~ s/$copy/PQR/, 'replaced $copy with PQR');
25132513
is($str, "PQR", 'final string should be PQR');
25142514
}
2515+
{
2516+
# github #21661
2517+
fresh_perl_is(<<'PROG', <<'EXPECT', {}, "double-free on fatal warn with existing error");
2518+
use warnings FATAL => qw(all);
2519+
/() {}/X;
2520+
PROG
2521+
Unknown regexp modifier "/X" at - line 2, at end of line
2522+
Unescaped left brace in regex is passed through in regex; marked by <-- HERE in m/() { <-- HERE }/ at - line 2.
2523+
Execution of - aborted due to compilation errors.
2524+
EXPECT
2525+
fresh_perl_is(<<'PROG', "", {}, "leak if __WARN__ handler dies");
2526+
use warnings;
2527+
local $SIG{__WARN__} = sub { die; };
2528+
eval "qr/()x{/;" for 1..10;
2529+
PROG
2530+
}
25152531
} # End of sub run_tests
25162532

25172533
1;

0 commit comments

Comments
 (0)