More UTF8_MAXLEN fixes
authorGisle Aas <gisle@aas.no>
Fri, 25 Feb 2000 00:24:53 +0000 (01:24 +0100)
committerJarkko Hietaniemi <jhi@iki.fi>
Thu, 24 Feb 2000 23:46:27 +0000 (23:46 +0000)
To: perl5-porters@perl.org
Message-ID: <m3ema2tc8q.fsf@eik.g.aas.no>

p4raw-id: //depot/cfgperl@5247

doop.c
op.c
perl.c
pp.c
regcomp.c
regexec.c
sv.c

diff --git a/doop.c b/doop.c
index 34cc0e3..0dbfe20 100644 (file)
--- a/doop.c
+++ b/doop.c
@@ -282,7 +282,7 @@ S_do_trans_CU_simple(pTHX_ SV *sv)
     UV extra = none + 1;
     UV final;
     UV uv;
-    U8 tmpbuf[10];
+    U8 tmpbuf[UTF8_MAXLEN];
     I32 bits = 16;
 
     s = (U8*)SvPV(sv, len);
diff --git a/op.c b/op.c
index 04a84b8..5b8a223 100644 (file)
--- a/op.c
+++ b/op.c
@@ -2607,7 +2607,7 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
        I32 to_utf      = o->op_private & OPpTRANS_TO_UTF;
 
        if (complement) {
-           U8 tmpbuf[10];
+           U8 tmpbuf[UTF8_MAXLEN];
            U8** cp;
            UV nextmin = 0;
            New(1109, cp, tlen, U8*);
diff --git a/perl.c b/perl.c
index 46ffde5..8f53c36 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -220,7 +220,7 @@ perl_construct(pTHXx)
        PL_patchlevel = NEWSV(0,4);
        SvUPGRADE(PL_patchlevel, SVt_PVNV);
        if (PERL_REVISION > 127 || PERL_VERSION > 127 || PERL_SUBVERSION > 127)
-           SvGROW(PL_patchlevel,24);
+           SvGROW(PL_patchlevel, UTF8_MAXLEN*3+1);
        s = (U8*)SvPVX(PL_patchlevel);
        s = uv_to_utf8(s, (UV)PERL_REVISION);
        s = uv_to_utf8(s, (UV)PERL_VERSION);
diff --git a/pp.c b/pp.c
index b6275dd..87d10f7 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -2254,7 +2254,7 @@ PP(pp_ucfirst)
 
     if (DO_UTF8(sv) && (s = (U8*)SvPV(sv, slen)) && slen && (*s & 0xc0) == 0xc0) {
        I32 ulen;
-       U8 tmpbuf[10];
+       U8 tmpbuf[UTF8_MAXLEN];
        U8 *tend;
        UV uv = utf8_to_uv(s, &ulen);
 
@@ -2313,7 +2313,7 @@ PP(pp_lcfirst)
 
     if (DO_UTF8(sv) && (s = (U8*)SvPV(sv, slen)) && slen && (*s & 0xc0) == 0xc0) {
        I32 ulen;
-       U8 tmpbuf[10];
+       U8 tmpbuf[UTF8_MAXLEN];
        U8 *tend;
        UV uv = utf8_to_uv(s, &ulen);
 
@@ -4645,7 +4645,7 @@ PP(pp_pack)
            while (len-- > 0) {
                fromstr = NEXTFROM;
                auint = SvUV(fromstr);
-               SvGROW(cat, SvCUR(cat) + 10);
+               SvGROW(cat, SvCUR(cat) + UTF8_MAXLEN);
                SvCUR_set(cat, (char*)uv_to_utf8((U8*)SvEND(cat),auint)
                               - SvPVX(cat));
            }
index a3106dc..8046c76 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -3646,7 +3646,7 @@ S_reguni(pTHX_ UV uv, char* s, I32* lenp)
 {
     dTHR;
     if (SIZE_ONLY) {
-       U8 tmpbuf[10];
+       U8 tmpbuf[UTF8_MAXLEN];
        *lenp = uv_to_utf8(tmpbuf, uv) - tmpbuf;
     }
     else
index bddf820..c65624b 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -3610,7 +3610,7 @@ S_reginclassutf8(pTHX_ regnode *f, U8 *p)
        match = TRUE;
     else if (flags & ANYOF_FOLD) {
        I32 cf;
-       U8 tmpbuf[10];
+       U8 tmpbuf[UTF8_MAXLEN];
        if (flags & ANYOF_LOCALE) {
            PL_reg_flags |= RF_tainted;
            uv_to_utf8(tmpbuf, toLOWER_LC_utf8(p));
diff --git a/sv.c b/sv.c
index fb33f38..2f5ea0b 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -5741,7 +5741,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
        bool is_utf = FALSE;
 
        char esignbuf[4];
-       U8 utf8buf[10];
+       U8 utf8buf[UTF8_MAXLEN];
        STRLEN esignlen = 0;
 
        char *eptr = Nullch;