summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-02-20 04:43:14 +0100
committerYves Orton <demerphq@gmail.com>2023-02-20 16:17:07 +0800
commitbbf836262130e1ab1030c03e3b3b390c28c4bbda (patch)
tree3c467a5a8c53c87fc1ee3e4e03a0bbcbdcee60e4 /t
parent0a73ee9e231197058947bf0a854703757dc357ac (diff)
downloadperl-bbf836262130e1ab1030c03e3b3b390c28c4bbda.tar.gz
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.
Diffstat (limited to 't')
-rw-r--r--t/re/pat.t16
1 files changed, 15 insertions, 1 deletions
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;