From: Nicholas Clark Date: Mon, 30 Jan 2006 00:18:52 +0000 (+0000) Subject: Assert that IVs and NVs can never be tainted. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=37c25af0ec94b55a9d5be380e5f1703e0afca56b;p=p5sagit%2Fp5-mst-13.2.git Assert that IVs and NVs can never be tainted. p4raw-id: //depot/perl@26997 --- diff --git a/sv.c b/sv.c index a177947..029de83 100644 --- a/sv.c +++ b/sv.c @@ -3146,8 +3146,11 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) SvIV_set(dstr, SvIVX(sstr)); if (SvIsUV(sstr)) SvIsUV_on(dstr); - if (SvTAINTED(sstr)) - SvTAINT(dstr); + /* SvTAINTED can only be true if the SV has taint magic, which in + turn means that the SV type is PVMG (or greater). This is the + case statement for SVt_IV, so this cannot be true (whatever gcov + may say). */ + assert(!SvTAINTED(sstr)); return; } goto undef_sstr; @@ -3167,8 +3170,11 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) } SvNV_set(dstr, SvNVX(sstr)); (void)SvNOK_only(dstr); - if (SvTAINTED(sstr)) - SvTAINT(dstr); + /* SvTAINTED can only be true if the SV has taint magic, which in + turn means that the SV type is PVMG (or greater). This is the + case statement for SVt_NV, so this cannot be true (whatever gcov + may say). */ + assert(!SvTAINTED(sstr)); return; } goto undef_sstr;