From: Gisle Aas Date: Wed, 14 Oct 1998 00:38:06 +0000 (+0200) Subject: utf8 substr can access memory outside PVX buffer X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bb40f870bbd8154ddbcccd483bf0c25730deedb5;p=p5sagit%2Fp5-mst-13.2.git utf8 substr can access memory outside PVX buffer Message-ID: p4raw-id: //depot/perl@2000 --- diff --git a/sv.c b/sv.c index ad38a87..97a0790 100644 --- a/sv.c +++ b/sv.c @@ -3134,12 +3134,16 @@ sv_pos_u2b(register SV *sv, I32* offsetp, I32* lenp) send = s + len; while (s < send && uoffset--) s += UTF8SKIP(s); + if (s >= send) + s = send; *offsetp = s - start; if (lenp) { I32 ulen = *lenp; start = s; while (s < send && ulen--) s += UTF8SKIP(s); + if (s >= send) + s = send; *lenp = s - start; } return;