This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
more taint fallout from change 24943
authorDave Mitchell <davem@fdisolutions.com>
Thu, 7 Jul 2005 14:47:51 +0000 (14:47 +0000)
committerDave Mitchell <davem@fdisolutions.com>
Thu, 7 Jul 2005 14:47:51 +0000 (14:47 +0000)
p4raw-id: //depot/perl@25094

mg.c
scope.c
t/op/taint.t

diff --git a/mg.c b/mg.c
index 9ae88c4..b126ec4 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1913,7 +1913,7 @@ int
 Perl_magic_gettaint(pTHX_ SV *sv, MAGIC *mg)
 {
     PERL_UNUSED_ARG(sv);
-    TAINT_IF(mg->mg_len & 1);
+    TAINT_IF((PL_localizing != 1) && (mg->mg_len & 1));
     return 0;
 }
 
diff --git a/scope.c b/scope.c
index 51d75b2..04fbec1 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -170,7 +170,9 @@ SV *
 Perl_save_scalar(pTHX_ GV *gv)
 {
     SV **sptr = &GvSV(gv);
+    PL_localizing = 1;
     SvGETMAGIC(*sptr);
+    PL_localizing = 0;
     SSCHECK(3);
     SSPUSHPTR(SvREFCNT_inc(gv));
     SSPUSHPTR(SvREFCNT_inc(*sptr));
index 9089d04..7f9d06e 100755 (executable)
@@ -17,7 +17,7 @@ use Config;
 use File::Spec::Functions;
 
 BEGIN { require './test.pl'; }
-plan tests => 243;
+plan tests => 244;
 
 
 $| = 1;
@@ -1128,3 +1128,10 @@ TERNARY_CONDITIONALS: {
     test tainted $x99;
 }
 
+# an mg_get of a tainted value during localization shouldn't taint the
+# statement
+
+{
+    eval { local $0, eval '1' };
+    test $@ eq '';
+}