From bbf836262130e1ab1030c03e3b3b390c28c4bbda Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Mon, 20 Feb 2023 04:43:14 +0100 Subject: regexec.c - add assert and test for savestack overflow in Issue #20826. We have a bug where we can overflow the save-stack. This tests for it in a TODO test. The next patch will fix it. Note the test will only fail in debugging as it requires the assert() to be compiled in. --- t/re/pat.t | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/re/pat.t b/t/re/pat.t index 2de4981195..d950c30ec9 100644 --- a/t/re/pat.t +++ b/t/re/pat.t @@ -27,7 +27,7 @@ skip_all_without_unicode_tables(); my $has_locales = locales_enabled('LC_CTYPE'); -plan tests => 1230; # Update this when adding/deleting tests. +plan tests => 1231; # Update this when adding/deleting tests. run_tests() unless caller; @@ -2413,6 +2413,20 @@ SKIP: is($y,"b","Branch reset in list context check 11 (b)"); is($z,"z","Branch reset in list context check 12 (z)"); } + TODO:{ + local $::TODO = "Will be fixed next commit"; + # Test for GH Issue #20826. Save stack overflow introduced in + # 92373dea9d7bcc0a017f20cb37192c1d8400767f PR #20530. + # Note this test depends on an assert so it will only fail + # under DEBUGGING. + fresh_perl_is(q{ + $_ = "x" x 1000; + my $pat = '(.)' x 200; + $pat = qr/($pat)+/; + m/$pat/; + print "ok"; + }, 'ok', {}, 'gh20826: test regex save stack overflow'); + } } # End of sub run_tests 1; -- cgit v1.2.1