diff options
author | Nicholas Clark <nick@ccl4.org> | 2004-06-14 15:26:38 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2004-06-14 15:26:38 +0000 |
commit | ffb05e06c71730527accd4c1399a30e98fb7f6d5 (patch) | |
tree | 0466afeb12a6e3fd8429258f0531c202702f6c13 /sv.c | |
parent | 5fff27bd847e99d376dc14e8b7fb6503335c47f9 (diff) | |
download | perl-ffb05e06c71730527accd4c1399a30e98fb7f6d5.tar.gz |
Assert that SV type has magic member when reading/writing.
Will catch buggy code.
p4raw-id: //depot/perl@22934
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1869,6 +1869,9 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) Perl_croak(aTHX_ "Can't upgrade that kind of scalar"); } + SvFLAGS(sv) &= ~SVTYPEMASK; + SvFLAGS(sv) |= mt; + switch (mt) { case SVt_NULL: Perl_croak(aTHX_ "Can't upgrade to undef"); @@ -2031,8 +2034,6 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) IoPAGE_LEN(sv) = 60; break; } - SvFLAGS(sv) &= ~SVTYPEMASK; - SvFLAGS(sv) |= mt; return TRUE; } |