X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pp.c;h=8877d8a469434c5f4992a6f00902a7e25dfd06bc;hb=23f3aea032e3289acf8e6a178372c27e8e03f4a0;hp=d4a1df0c507f3dee510565ab76c841becbf0a341;hpb=d2560b705d852dbc96fd94b95faaa076758b7a8c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pp.c b/pp.c index d4a1df0..8877d8a 100644 --- a/pp.c +++ b/pp.c @@ -2195,7 +2195,7 @@ PP(pp_ord) I32 retlen; if ((*tmps & 0x80) && DO_UTF8(tmpsv)) - value = utf8_to_uv(tmps, &retlen, 0); + value = utf8_to_uv_chk(tmps, &retlen, 0); else value = (UV)(*tmps & 255); XPUSHu(value); @@ -2262,7 +2262,7 @@ PP(pp_ucfirst) I32 ulen; U8 tmpbuf[UTF8_MAXLEN]; U8 *tend; - UV uv = utf8_to_uv(s, &ulen, 0); + UV uv = utf8_to_uv_chk(s, &ulen, 0); if (PL_op->op_private & OPpLOCALE) { TAINT; @@ -2321,7 +2321,7 @@ PP(pp_lcfirst) I32 ulen; U8 tmpbuf[UTF8_MAXLEN]; U8 *tend; - UV uv = utf8_to_uv(s, &ulen, 0); + UV uv = utf8_to_uv_chk(s, &ulen, 0); if (PL_op->op_private & OPpLOCALE) { TAINT; @@ -2398,7 +2398,7 @@ PP(pp_uc) TAINT; SvTAINTED_on(TARG); while (s < send) { - d = uv_to_utf8(d, toUPPER_LC_uni( utf8_to_uv(s, &ulen, 0))); + d = uv_to_utf8(d, toUPPER_LC_uni( utf8_to_uv_chk(s, &ulen, 0))); s += ulen; } } @@ -2472,7 +2472,7 @@ PP(pp_lc) TAINT; SvTAINTED_on(TARG); while (s < send) { - d = uv_to_utf8(d, toLOWER_LC_uni( utf8_to_uv(s, &ulen, 0))); + d = uv_to_utf8(d, toLOWER_LC_uni( utf8_to_uv_chk(s, &ulen, 0))); s += ulen; } } @@ -3614,7 +3614,7 @@ PP(pp_unpack) len = strend - s; if (checksum) { while (len-- > 0 && s < strend) { - auint = utf8_to_uv((U8*)s, &along, 0); + auint = utf8_to_uv_chk((U8*)s, &along, 0); s += along; if (checksum > 32) cdouble += (NV)auint; @@ -3626,7 +3626,7 @@ PP(pp_unpack) EXTEND(SP, len); EXTEND_MORTAL(len); while (len-- > 0 && s < strend) { - auint = utf8_to_uv((U8*)s, &along, 0); + auint = utf8_to_uv_chk((U8*)s, &along, 0); s += along; sv = NEWSV(37, 0); sv_setuv(sv, (UV)auint); @@ -4974,6 +4974,7 @@ PP(pp_split) AV *ary; register I32 limit = POPi; /* note, negative is forever */ SV *sv = POPs; + bool isutf = DO_UTF8(sv); STRLEN len; register char *s = SvPV(sv, len); char *strend = s + len; @@ -5076,6 +5077,8 @@ PP(pp_split) sv_setpvn(dstr, s, m-s); if (make_mortal) sv_2mortal(dstr); + if (isutf) + (void)SvUTF8_on(dstr); XPUSHs(dstr); s = m + 1; @@ -5096,6 +5099,8 @@ PP(pp_split) sv_setpvn(dstr, s, m-s); if (make_mortal) sv_2mortal(dstr); + if (isutf) + (void)SvUTF8_on(dstr); XPUSHs(dstr); s = m; } @@ -5119,6 +5124,8 @@ PP(pp_split) sv_setpvn(dstr, s, m-s); if (make_mortal) sv_2mortal(dstr); + if (isutf) + (void)SvUTF8_on(dstr); XPUSHs(dstr); s = m + 1; } @@ -5134,6 +5141,8 @@ PP(pp_split) sv_setpvn(dstr, s, m-s); if (make_mortal) sv_2mortal(dstr); + if (isutf) + (void)SvUTF8_on(dstr); XPUSHs(dstr); s = m + len; /* Fake \n at the end */ } @@ -5161,6 +5170,8 @@ PP(pp_split) sv_setpvn(dstr, s, m-s); if (make_mortal) sv_2mortal(dstr); + if (isutf) + (void)SvUTF8_on(dstr); XPUSHs(dstr); if (rx->nparens) { for (i = 1; i <= rx->nparens; i++) { @@ -5174,6 +5185,8 @@ PP(pp_split) dstr = NEWSV(33, 0); if (make_mortal) sv_2mortal(dstr); + if (isutf) + (void)SvUTF8_on(dstr); XPUSHs(dstr); } } @@ -5192,6 +5205,8 @@ PP(pp_split) sv_setpvn(dstr, s, strend-s); if (make_mortal) sv_2mortal(dstr); + if (isutf) + (void)SvUTF8_on(dstr); XPUSHs(dstr); iters++; }