summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorAndrew Pimlott <pimlott@idiomtech.com>2000-10-04 19:17:44 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2000-11-05 01:12:16 +0000
commit27c9684d3c5aa5a9dfb043ed1fc98a708d464c22 (patch)
treec820b4e88cf9fd3d06c5e8257da98f27e29c60b5 /t
parentb267dd9ebed83db4ea37fda8fc7e5d3ef2916795 (diff)
downloadperl-27c9684d3c5aa5a9dfb043ed1fc98a708d464c22.tar.gz
Fix for
Subject: [ID 20001004.007] taint propogation is inconsistent Message-Id: <m13h1XU-000SEmC@nolfolan.idiomtech.com> The culprit was sv_setsv() which was rather blindly propagating taint, which lead to behaviour where if a tainted anon hash value was seen all the hash values from then on at that level became tainted, or at any upper levels in the case of nested anon hashes. p4raw-id: //depot/perl@7553
Diffstat (limited to 't')
-rwxr-xr-xt/op/taint.t31
1 files changed, 30 insertions, 1 deletions
diff --git a/t/op/taint.t b/t/op/taint.t
index fc3a595c4e..1e3d3964c2 100755
--- a/t/op/taint.t
+++ b/t/op/taint.t
@@ -99,7 +99,7 @@ print PROG 'print "@ARGV\n"', "\n";
close PROG;
my $echo = "$Invoke_Perl $ECHO";
-print "1..152\n";
+print "1..155\n";
# First, let's make sure that Perl is checking the dangerous
# environment variables. Maybe they aren't set yet, so we'll
@@ -690,4 +690,33 @@ else {
my $b = <IN>;
print "not " unless tainted($a) && tainted($b) && !defined($b);
print "ok 152\n";
+ close IN;
}
+
+{
+ # bug id 20001004.007
+
+ open IN, "./TEST" or warn "$0: cannot read ./TEST: $!" ;
+ my $a = <IN>;
+
+ my $c = { a => 42,
+ b => $a };
+ print "not " unless !tainted($c->{a}) && tainted($c->{b});
+ print "ok 153\n";
+
+ my $d = { a => $a,
+ b => 42 };
+ print "not " unless tainted($d->{a}) && !tainted($d->{b});
+ print "ok 154\n";
+
+ my $e = { a => 42,
+ b => { c => $a, d => 42 } };
+ print "not " unless !tainted($e->{a}) &&
+ !tainted($e->{b}) &&
+ tainted($e->{b}->{c}) &&
+ !tainted($e->{b}->{d});
+ print "ok 155\n";
+
+ close IN;
+}
+