This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
TODO tests for eval of tainted scalars. (change 29193's regression)
authorNicholas Clark <nick@ccl4.org>
Wed, 7 Feb 2007 23:49:44 +0000 (23:49 +0000)
committerNicholas Clark <nick@ccl4.org>
Wed, 7 Feb 2007 23:49:44 +0000 (23:49 +0000)
p4raw-id: //depot/perl@30167

t/op/taint.t

index ec7c498..f661108 100755 (executable)
@@ -17,7 +17,7 @@ use Config;
 use File::Spec::Functions;
 
 BEGIN { require './test.pl'; }
-plan tests => 257;
+plan tests => 260;
 
 $| = 1;
 
@@ -1214,3 +1214,19 @@ SKIP:
     $val = $n;
     is ($val, '7000000000', 'Assignment to tainted variable');
 }
+
+{
+    local $::TODO = "eval currently ignores tainting";
+    my $val = 0;
+    my $tainted = '1' . $TAINT;
+    eval '$val = eval $tainted;';
+    is ($val, 0, "eval doesn't like tainted strings");
+    like ($@, qr/^Insecure dependency in eval/);
+
+    # Rather nice code to get a tainted by from Rick Delaney
+    open 0 or die $!;
+    $tainted=(<0>,<0>);
+
+    eval 'eval $tainted';
+    like ($@, qr/^Insecure dependency in eval/);
+}