Package: perl
Version: 5.14.2-14

The attached perl program behaves differently in taint mode compared to non taint mode:

#!/usr/bin/perl -w
use strict;
use feature qw (switch);

my $tainted_var = $ENV{X};
given ($tainted_var)
{ when ([0, 1])
  { print "smart match\n";
  }
}

If X is set to 0 there is no difference:

$ X=0 perl taintbug
smart match
$ X=0 perl -T taintbug
smart match
$

If X is set to 1 the "when" block is not entered in taint mode and nothing is printed

$ X=1 perl -T taintbug
$

whereas in non taint mode it behaves like expected:

$ X=1 perl taintbug
smart match
$

I consider this a bug.


Best regards

--
Christoph Nodes
#!/usr/bin/perl -w
use strict;
use feature qw (switch);

my $tainted_var = 1;
given ($tainted_var)
{ when ([0, 1])
  { print "smart match\n";
  }
}

Reply via email to