summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-03-31 06:28:49 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-03-31 06:28:49 -0700
commit539689e74a3bcb04d29e4cd9396de91a81045b99 (patch)
tree06bda337e524215a894848863bc99947114a7a26 /t
parent968ee499ff66c6dcd466884030cb185844f2d94f (diff)
downloadperl-539689e74a3bcb04d29e4cd9396de91a81045b99.tar.gz
[perl #87336] lc/uc(first) fail to taint the returned string
This bug was caused by change 28011 (ec9af7d), which stopped pp_lc from using sv_setsv_flags, thereby bypassing these two lines at the end of that function: if (SvTAINTED(sstr)) SvTAINT(dstr); Change 28012 (6730619) did exactly the same thing to pp_uc. 28013 (d54190f) broke ucfirst and lcfirst. This commit simply puts that taint logic at the end of the pp_* functions.
Diffstat (limited to 't')
-rw-r--r--t/op/taint.t15
1 files changed, 14 insertions, 1 deletions
diff --git a/t/op/taint.t b/t/op/taint.t
index c695570bfe..9df6fee35c 100644
--- a/t/op/taint.t
+++ b/t/op/taint.t
@@ -17,7 +17,7 @@ BEGIN {
use strict;
use Config;
-plan tests => 770;
+plan tests => 774;
$| = 1;
@@ -2131,6 +2131,19 @@ end
"user-defined property: tainted case");
}
+{
+ # [perl #87336] lc/uc(first) failing to taint the returned string
+ my $source = "foo$TAINT";
+ my $dest = lc $source;
+ is_tainted $dest, "lc(tainted) taints its return value";
+ $dest = lcfirst $source;
+ is_tainted $dest, "lcfirst(tainted) taints its return value";
+ $dest = uc $source;
+ is_tainted $dest, "uc(tainted) taints its return value";
+ $dest = ucfirst $source;
+ is_tainted $dest, "ucfirst(tainted) taints its return value";
+}
+
# This may bomb out with the alarm signal so keep it last
SKIP: {
skip "No alarm()" unless $Config{d_alarm};