From: Dave Mitchell Date: Thu, 7 Jul 2005 14:47:51 +0000 (+0000) Subject: more taint fallout from change 24943 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=27cc343c4fb8030e5afb7c3824647d9e5e1d08d6;p=p5sagit%2Fp5-mst-13.2.git more taint fallout from change 24943 p4raw-id: //depot/perl@25094 --- diff --git a/mg.c b/mg.c index 9ae88c4..b126ec4 100644 --- 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 --- 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)); diff --git a/t/op/taint.t b/t/op/taint.t index 9089d04..7f9d06e 100755 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -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 ''; +}