#ifndef INCOMPLETE_TAINTS
if (PL_tainting) {
- if (PL_tainted)
+ if (PL_tainted) {
+ SvTAINTED_on((SV*)re);
RX_EXTFLAGS(re) |= RXf_TAINTED;
+ }
else
RX_EXTFLAGS(re) &= ~RXf_TAINTED;
}
(void)sv_bless(rv, stash);
}
- if (RX_EXTFLAGS(rx) & RXf_TAINTED)
+ if (RX_EXTFLAGS(rx) & RXf_TAINTED) {
SvTAINTED_on(rv);
+ SvTAINTED_on(SvRV(rv));
+ }
XPUSHs(rv);
RETURN;
}
use File::Spec::Functions;
BEGIN { require './test.pl'; }
-plan tests => 684;
+plan tests => 687;
$| = 1;
ok( ! tainted($z), "Constants folded value not tainted");
}
+{
+ # now that regexes are first class SVs, make sure that they themselves
+ # as well as references to them are tainted
+
+ my $rr = qr/(.)$TAINT/;
+ my $r = $$rr; # bare REGEX
+ my $s ="abc";
+ ok($s =~ s/$r/x/, "match bare regex");
+ ok(tainted($s), "match bare regex taint");
+ is($s, 'xbc', "match bare regex taint value");
+}
+
# This may bomb out with the alarm signal so keep it last
SKIP: {
skip "No alarm()" unless $Config{d_alarm};