diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2005-01-22 02:20:12 +0200 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2005-01-22 00:17:40 +0000 |
commit | 89ebb4a3f2a55825eeed13aaf58db5c73d2140ef (patch) | |
tree | a66444144493fa61d6befce0c9bf1358973f9872 /doop.c | |
parent | 80a13697042a4d823de61ba24b77aa9d893765d6 (diff) | |
download | perl-89ebb4a3f2a55825eeed13aaf58db5c73d2140ef.tar.gz |
Re: uc($long_utf8_string) exhausts memory
Message-Id: <41F1801C.3080201@iki.fi>
Make buffer size estimates for utf8 case conversion less maximally
pessimistic
p4raw-id: //depot/perl@23857
Diffstat (limited to 'doop.c')
-rw-r--r-- | doop.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -338,7 +338,7 @@ S_do_trans_simple_utf8(pTHX_ SV *sv) if (grows) { /* d needs to be bigger than s, in case e.g. upgrading is required */ - New(0, d, len*3+UTF8_MAXLEN, U8); + New(0, d, len * 3 + UTF8_MAXBYTES, U8); dend = d + len * 3; dstart = d; } @@ -370,10 +370,10 @@ S_do_trans_simple_utf8(pTHX_ SV *sv) if (d > dend) { STRLEN clen = d - dstart; - STRLEN nlen = dend - dstart + len + UTF8_MAXLEN; + STRLEN nlen = dend - dstart + len + UTF8_MAXBYTES; if (!grows) Perl_croak(aTHX_ "panic: do_trans_simple_utf8 line %d",__LINE__); - Renew(dstart, nlen+UTF8_MAXLEN, U8); + Renew(dstart, nlen + UTF8_MAXBYTES, U8); d = dstart + clen; dend = dstart + nlen; } @@ -480,7 +480,7 @@ S_do_trans_complex_utf8(pTHX_ SV *sv) if (grows) { /* d needs to be bigger than s, in case e.g. upgrading is required */ - New(0, d, len*3+UTF8_MAXLEN, U8); + New(0, d, len * 3 + UTF8_MAXBYTES, U8); dend = d + len * 3; dstart = d; } @@ -496,10 +496,10 @@ S_do_trans_complex_utf8(pTHX_ SV *sv) if (d > dend) { STRLEN clen = d - dstart; - STRLEN nlen = dend - dstart + len + UTF8_MAXLEN; + STRLEN nlen = dend - dstart + len + UTF8_MAXBYTES; if (!grows) Perl_croak(aTHX_ "panic: do_trans_complex_utf8 line %d",__LINE__); - Renew(dstart, nlen+UTF8_MAXLEN, U8); + Renew(dstart, nlen + UTF8_MAXBYTES, U8); d = dstart + clen; dend = dstart + nlen; } @@ -550,10 +550,10 @@ S_do_trans_complex_utf8(pTHX_ SV *sv) uv = swash_fetch(rv, s, TRUE); if (d > dend) { STRLEN clen = d - dstart; - STRLEN nlen = dend - dstart + len + UTF8_MAXLEN; + STRLEN nlen = dend - dstart + len + UTF8_MAXBYTES; if (!grows) Perl_croak(aTHX_ "panic: do_trans_complex_utf8 line %d",__LINE__); - Renew(dstart, nlen+UTF8_MAXLEN, U8); + Renew(dstart, nlen + UTF8_MAXBYTES, U8); d = dstart + clen; dend = dstart + nlen; } |