Change 34987 by [EMAIL PROTECTED] on 2008/12/03 09:19:32
Fix for tainting regression in a test of Text::Template spotted by
Andreas' smoker.
Affected files ...
... //depot/perl/scope.c#249 edit
... //depot/perl/t/op/taint.t#92 edit
Differences ...
==== //depot/perl/scope.c#249 (text) ====
Index: perl/scope.c
--- perl/scope.c#248~34973~ 2008-12-01 14:17:55.000000000 -0800
+++ perl/scope.c 2008-12-03 01:19:32.000000000 -0800
@@ -648,6 +648,8 @@
void* ptr;
register char* str;
I32 i;
+ /* Localise the effects of the TAINT_NOT inside the loop. */
+ const bool was = PL_tainted;
if (base < -1)
Perl_croak(aTHX_ "panic: corrupt saved stack index");
@@ -1065,6 +1067,8 @@
Perl_croak(aTHX_ "panic: leave_scope inconsistency");
}
}
+
+ PL_tainted = was;
}
void
==== //depot/perl/t/op/taint.t#92 (xtext) ====
Index: perl/t/op/taint.t
--- perl/t/op/taint.t#91~34860~ 2008-11-16 23:33:24.000000000 -0800
+++ perl/t/op/taint.t 2008-12-03 01:19:32.000000000 -0800
@@ -17,7 +17,7 @@
use File::Spec::Functions;
BEGIN { require './test.pl'; }
-plan tests => 271;
+plan tests => 298;
$| = 1;
@@ -1267,6 +1267,42 @@
ok(!tainted($b), "untainted complement");
}
+{
+ my @data = qw(bonk zam zlonk qunckkk);
+ # Clearly some sort of usenet bang-path
+ my $string = $TAINT . join "!", @data;
+
+ ok(tainted($string), "tainted data");
+
+ my @got = split /!|,/, $string;
+
+ # each @got would be useful here, but I want the test for earlier perls
+ for my $i (0 .. $#data) {
+ ok(tainted($got[$i]), "tainted result $i");
+ is($got[$i], $data[$i], "correct content $i");
+ }
+
+ ok(tainted($string), "still tainted data");
+
+ my @got = split /[!,]/, $string;
+
+ # each @got would be useful here, but I want the test for earlier perls
+ for my $i (0 .. $#data) {
+ ok(tainted($got[$i]), "tainted result $i");
+ is($got[$i], $data[$i], "correct content $i");
+ }
+
+ ok(tainted($string), "still tainted data");
+
+ my @got = split /!/, $string;
+
+ # each @got would be useful here, but I want the test for earlier perls
+ for my $i (0 .. $#data) {
+ ok(tainted($got[$i]), "tainted result $i");
+ is($got[$i], $data[$i], "correct content $i");
+ }
+}
+
# This may bomb out with the alarm signal so keep it last
SKIP: {
skip "No alarm()" unless $Config{d_alarm};
End of Patch.