Re: perl@7078
Spider Boardman [Thu, 14 Sep 2000 19:06:36 +0000 (15:06 -0400)]
Message-Id: <200009142306.TAA20082@leggy.zk3.dec.com>

p4raw-id: //depot/perl@7090

sv.c
toke.c

diff --git a/sv.c b/sv.c
index a89c49a..a694fed 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -2412,9 +2412,9 @@ Perl_sv_utf8_upgrade(pTHX_ register SV *sv)
     if (hibit) {
        STRLEN len = SvCUR(sv) + 1; /* Plus the \0 */
        SvPVX(sv) = (char*)bytes_to_utf8((U8*)s, &len);
-       SvCUR(sv) = len - 1;
+       SvCUR(sv) = len; /* No longer know the real size. */
        SvUTF8_on(sv);
-       Safefree(s); /* No longer using what was there before */
+       Safefree(s); /* No longer using what was there before. */
     }
 }
 
diff --git a/toke.c b/toke.c
index e75d878..9821201 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1490,6 +1490,8 @@ S_scan_const(pTHX_ char *start)
                        SvCUR_set(sv, d - ostart);
                        SvPOK_on(sv);
                        sv_utf8_upgrade(sv);
+                       /* this just broke our allocation above... */
+                       SvGROW(sv, send - start);
                        d = SvPVX(sv) + SvCUR(sv);
                        has_utf = TRUE;
                    }