summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2012-03-11 14:38:57 +1100
committerRicardo Signes <rjbs@cpan.org>2012-08-09 16:04:11 -0400
commit3f22bd654dbafc1220c5360d5e685b11d99a5404 (patch)
tree8b24d1c48989b7d201ba566a5a644476c9143939
parentee4a2a70c059f719bca4701c84452297d9cc153f (diff)
downloadperl-3f22bd654dbafc1220c5360d5e685b11d99a5404.tar.gz
properly propagate tainted errors
Backport af89892ed and 05a1a0145d by Tony Cook to 5.14 Bug: https://rt.perl.org/rt3/Public/Bug/Display.html?id=111654 Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663158
-rw-r--r--pp_sys.c2
-rw-r--r--t/op/taint.t10
2 files changed, 9 insertions, 3 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 3c421332c0..fbf11249ff 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -497,7 +497,7 @@ PP(pp_die)
}
}
}
- else if (SvPOK(ERRSV) && SvCUR(ERRSV)) {
+ else if (SvPV_const(ERRSV, len), len) {
exsv = sv_mortalcopy(ERRSV);
sv_catpvs(exsv, "\t...propagated");
}
diff --git a/t/op/taint.t b/t/op/taint.t
index a300b9b264..3a2b5d9396 100644
--- a/t/op/taint.t
+++ b/t/op/taint.t
@@ -17,7 +17,7 @@ BEGIN {
use strict;
use Config;
-plan tests => 778;
+plan tests => 779;
$| = 1;
@@ -2156,7 +2156,13 @@ end
ok(!tainted "", "tainting still works after index() of the constant");
}
-
+{ # 111654
+ eval {
+ eval { die "Test\n".substr($ENV{PATH}, 0, 0); };
+ die;
+ };
+ like($@, qr/^Test\n\t\.\.\.propagated at /, "error should be propagated");
+}
# This may bomb out with the alarm signal so keep it last
SKIP: {