develooper Front page | perl.perl5.porters | Postings from December 2008

Re: taint copying (was Re: 5.8.9/taint/NYTProf regression)

Thread Previous | Thread Next
From:
Chip Salzenberg
Date:
December 1, 2008 22:51
Subject:
Re: taint copying (was Re: 5.8.9/taint/NYTProf regression)
Message ID:
20081202065017.GQ31089@tytlal.topaz.cx
On Mon, Dec 01, 2008 at 11:52:03PM -0500, Rick Delaney wrote:
> diff -pruNb perl-5.8.x/scope.c perl-5.8.9-RC1/scope.c
> --- perl-5.8.x/scope.c	2008-10-29 04:23:15.000000000 -0400
> +++ perl-5.8.9-RC1/scope.c	2008-12-01 23:27:07.000000000 -0500
> @@ -621,12 +621,17 @@ Perl_leave_scope(pTHX_ I32 base)
>  	const int type = SSPOPINT;
>  	switch (type) {
>  	case SAVEt_ITEM:			/* normal string */
> +	    {
> +		bool was_tainted = 0;
>  	    value = (SV*)SSPOPPTR;
>  	    sv = (SV*)SSPOPPTR;
> +		was_tainted = SvTAINTED(value);
>  	    sv_replace(sv,value);
> +		was_tainted ? SvTAINTED_on(sv) : SvTAINTED_off(sv);
>  	    PL_localizing = 2;
>  	    SvSETMAGIC(sv);
>  	    PL_localizing = 0;
> +	    }
>  	    break;
>  	case SAVEt_SV:				/* scalar reference */
>  	    value = (SV*)SSPOPPTR;

Since SvSETMAGIC() could set or clear the taint flag, perhaps any manual
manipulation of that flag go _after_ the SvSETMAGIC?
-- 
Chip Salzenberg   twitter:chipsalz
"UTOPIA PLANITIA IS IN ORBIT is the new HAN SHOT FIRST" - Crisper Than Thou

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About