Explode if anyone attempts to sv_upgrade PL_mess_sv.
Nicholas Clark [Sun, 1 May 2005 22:16:16 +0000 (22:16 +0000)]
Should this be a panic: ?

p4raw-id: //depot/perl@24357

sv.c

diff --git a/sv.c b/sv.c
index 2c598f7..f9858e8 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1849,6 +1849,10 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt)
        del_XPVNV(SvANY(sv));
        break;
     case SVt_PVMG:
+       /* Because the XPVMG of PL_mess_sv isn't allocated from the arena,
+          there's no way that it can be safely upgraded, because perl.c
+          expects to Safefree(SvANY(PL_mess_sv))  */
+       assert(sv != PL_mess_sv);
        pv      = SvPVX(sv);
        cur     = SvCUR(sv);
        len     = SvLEN(sv);