summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-01-02 21:10:13 +0000
committerNicholas Clark <nick@ccl4.org>2007-01-02 21:10:13 +0000
commit085bde857c12ca3212eb9b96db84091274a8025c (patch)
tree9bfcb8f931a10077e04126004d4dc76ad9a51a4c /mg.c
parent2e94196c9b65166bc30c1956b01df877a36f8934 (diff)
downloadperl-085bde857c12ca3212eb9b96db84091274a8025c.tar.gz
Assignment to a tainted variable was causing confusion if the source
value was an NV too large for an IV (bug #40708). Fix the confusion by not promoting private flags to public flags in S_save_magic if there are already public flags. p4raw-id: //depot/perl@29669
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index a0877c5346..c5566dca77 100644
--- a/mg.c
+++ b/mg.c
@@ -100,7 +100,10 @@ S_save_magic(pTHX_ I32 mgs_ix, SV *sv)
SvMAGICAL_off(sv);
SvREADONLY_off(sv);
- SvFLAGS(sv) |= (SvFLAGS(sv) & (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
+ if (!(SvFLAGS(sv) & (SVf_IOK|SVf_NOK|SVf_POK))) {
+ /* No public flags are set, so promote any private flags to public. */
+ SvFLAGS(sv) |= (SvFLAGS(sv) & (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
+ }
}
/*