summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/perl/perl-5.14.2/debian/fixes/index-tainting.diff
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/perl/perl-5.14.2/debian/fixes/index-tainting.diff')
-rw-r--r--meta/recipes-devtools/perl/perl-5.14.2/debian/fixes/index-tainting.diff73
1 files changed, 73 insertions, 0 deletions
diff --git a/meta/recipes-devtools/perl/perl-5.14.2/debian/fixes/index-tainting.diff b/meta/recipes-devtools/perl/perl-5.14.2/debian/fixes/index-tainting.diff
new file mode 100644
index 0000000000..204e9992a9
--- /dev/null
+++ b/meta/recipes-devtools/perl/perl-5.14.2/debian/fixes/index-tainting.diff
@@ -0,0 +1,73 @@
1From e25298a339dd6679f1b080f0125ac1b237b87950 Mon Sep 17 00:00:00 2001
2From: David Mitchell <davem@iabyn.com>
3Date: Tue, 28 Jun 2011 17:04:40 +0100
4Subject: RT 64804: tainting with index() of a constant
5
6Bug: http://rt.perl.org/rt3/Public/Bug/Display.html?id=64804
7Bug-Debian: http://bugs.debian.org/291450
8Origin: upstream, http://perl5.git.perl.org/perl.git/commit/3b36395d31cf0a2f3a017505cd0ea857a7acb5d1
9
10At compile time, ck_index with a tainted constant set PL_tainted,
11which remained on during the rest of compilation, tainting all other
12constants.
13
14Fix this by saving and restoring PL_tainted across the call to
15fbm_compile, which is what sets PL_tainted.
16
17Patch-Name: fixes/index-tainting.diff
18---
19 op.c | 5 ++++-
20 t/op/taint.t | 16 +++++++++++++++-
21 2 files changed, 19 insertions(+), 2 deletions(-)
22
23diff --git a/op.c b/op.c
24index e21b9a4..973df13 100644
25--- a/op.c
26+++ b/op.c
27@@ -7780,8 +7780,11 @@ Perl_ck_index(pTHX_ OP *o)
28 OP *kid = cLISTOPo->op_first->op_sibling; /* get past pushmark */
29 if (kid)
30 kid = kid->op_sibling; /* get past "big" */
31- if (kid && kid->op_type == OP_CONST)
32+ if (kid && kid->op_type == OP_CONST) {
33+ const bool save_taint = PL_tainted;
34 fbm_compile(((SVOP*)kid)->op_sv, 0);
35+ PL_tainted = save_taint;
36+ }
37 }
38 return ck_fun(o);
39 }
40diff --git a/t/op/taint.t b/t/op/taint.t
41index 9df6fee..a300b9b 100644
42--- a/t/op/taint.t
43+++ b/t/op/taint.t
44@@ -17,7 +17,7 @@ BEGIN {
45 use strict;
46 use Config;
47
48-plan tests => 774;
49+plan tests => 778;
50
51 $| = 1;
52
53@@ -2144,6 +2144,20 @@ end
54 is_tainted $dest, "ucfirst(tainted) taints its return value";
55 }
56
57+
58+# tainted constants and index()
59+# RT 64804; http://bugs.debian.org/291450
60+{
61+ ok(tainted $old_env_path, "initial taintedness");
62+ BEGIN { no strict 'refs'; my $v = $old_env_path; *{"::C"} = sub () { $v }; }
63+ ok(tainted C, "constant is tainted properly");
64+ ok(!tainted "", "tainting not broken yet");
65+ index(undef, C);
66+ ok(!tainted "", "tainting still works after index() of the constant");
67+}
68+
69+
70+
71 # This may bomb out with the alarm signal so keep it last
72 SKIP: {
73 skip "No alarm()" unless $Config{d_alarm};