summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2013-03-18 16:41:42 +0000
committerDavid Mitchell <davem@iabyn.com>2013-03-18 16:41:42 +0000
commitda1f5b59634bdfea59787843016be4809df50836 (patch)
tree32dfebcbf85eed4d0d7dce4074ad8ebd7ed84f17 /t
parentcdac396140ede59138b67af076981d0438e36b8b (diff)
downloadperl-da1f5b59634bdfea59787843016be4809df50836.tar.gz
fix a segfault in run-time qr//s with (?{})
While assembling the regex, it was was examining CONSTs in the optree using the wrong pad. When consts are moved into the pad on threaded builds, segvs might be the result.
Diffstat (limited to 't')
-rw-r--r--t/re/pat_re_eval.t19
1 files changed, 18 insertions, 1 deletions
diff --git a/t/re/pat_re_eval.t b/t/re/pat_re_eval.t
index 061e7e5076..cef15a0fbd 100644
--- a/t/re/pat_re_eval.t
+++ b/t/re/pat_re_eval.t
@@ -23,7 +23,7 @@ BEGIN {
}
-plan tests => 463; # Update this when adding/deleting tests.
+plan tests => 464; # Update this when adding/deleting tests.
run_tests() unless caller;
@@ -1041,6 +1041,23 @@ sub run_tests {
is($m, 'a', '?pat? with (??{a,b,c})');
}
+ {
+ # this code won't actually fail, but it used to fail valgrind,
+ # so its here just to make sure valgrind doesn't fail again
+ # While examining the ops of the secret anon sub wrapped around
+ # the qr//, the pad of the sub was in scope, so cSVOPo_sv
+ # got the const from the wrong pad. By having lots of $s's
+ # (aka gvsv(*s), this forces the targs of the consts which have
+ # been moved to the pad, to have high indices.
+
+ sub {
+ local our $s = "abc";
+ my $qr = qr/^(?{1})$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s/;
+ }->();
+ pass("cSVOPo_sv");
+ }
+
+
} # End of sub run_tests