diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-12-03 10:55:42 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-12-03 10:55:42 +0000 |
commit | 7427eea3123087ae35e6f517309b375f86e8e8be (patch) | |
tree | 4f37cf7c333ff49b048025dcc3da652e8ebfb791 | |
parent | 8372250bae79b2ca0c56503d7818ae0068b871f0 (diff) | |
download | perl-7427eea3123087ae35e6f517309b375f86e8e8be.tar.gz |
Integrate:
[ 34988]
Integrate:
[ 34987]
Fix for tainting regression in a test of Text::Template spotted by
Andreas' smoker.
p4raw-link: @34988 on //depot/maint-5.10/perl: 6f0b56d3adad6639c2c16914af28bb55e5a34877
p4raw-link: @34987 on //depot/perl: 302c0c93356e52f02a8925ac90ae96bf8db31000
p4raw-id: //depot/maint-5.8/perl@34990
p4raw-integrated: from //depot/maint-5.10/perl@34978 'edit in'
t/op/taint.t (@34273..) 'merge in' scope.c (@34962..)
-rw-r--r-- | scope.c | 4 | ||||
-rwxr-xr-x | t/op/taint.t | 38 |
2 files changed, 41 insertions, 1 deletions
@@ -614,6 +614,8 @@ Perl_leave_scope(pTHX_ I32 base) 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"); @@ -1064,6 +1066,8 @@ Perl_leave_scope(pTHX_ I32 base) Perl_croak(aTHX_ "panic: leave_scope inconsistency"); } } + + PL_tainted = was; } void diff --git a/t/op/taint.t b/t/op/taint.t index 415ca5e424..9ce73a0e66 100755 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -17,7 +17,7 @@ use Config; use File::Spec::Functions; BEGIN { require './test.pl'; } -plan tests => 263; +plan tests => 290; $| = 1; @@ -1241,6 +1241,42 @@ foreach my $ord (78, 163, 256) { ok(!tainted($1), "\\S match with chr $ord"); } +{ + 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}; |