numeric conversion of non-number in change#3378 tramples on
Gurusamy Sarathy [Fri, 28 Apr 2000 07:15:04 +0000 (07:15 +0000)]
OOK offset, causing segfaults

p4raw-link: @3378 on //depot/perl: 25da4f389200e19df8aa50bcef9af9506f48ed2e

p4raw-id: //depot/perl@5983

sv.c

diff --git a/sv.c b/sv.c
index a996471..b83444a 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1483,8 +1483,8 @@ Perl_sv_2iv(pTHX_ register SV *sv)
 
            if (SvTYPE(sv) < SVt_PVIV)
                sv_upgrade(sv, SVt_PVIV);
-           SvIVX(sv) = 0;
            (void)SvIOK_on(sv);
+           SvIVX(sv) = 0;
            if (ckWARN(WARN_NUMERIC))
                not_a_number(sv);
        }
@@ -1637,10 +1637,10 @@ Perl_sv_2uv(pTHX_ register SV *sv)
 
            if (SvTYPE(sv) < SVt_PVIV)
                sv_upgrade(sv, SVt_PVIV);
-           SvUVX(sv) = 0;              /* We assume that 0s have the
-                                          same bitmap in IV and UV. */
            (void)SvIOK_on(sv);
            (void)SvIsUV_on(sv);
+           SvUVX(sv) = 0;              /* We assume that 0s have the
+                                          same bitmap in IV and UV. */
            if (ckWARN(WARN_NUMERIC))
                not_a_number(sv);
        }