diff options
author | Gisle Aas <gisle@aas.no> | 1998-10-14 02:38:06 +0200 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-10-17 03:06:33 +0000 |
commit | bb40f870bbd8154ddbcccd483bf0c25730deedb5 (patch) | |
tree | 91d1ec2166d76ed485e00ce2918ffd16202fcd30 | |
parent | c1441b1036cd8cd94473c6ac4ca8b480bfe1e4e2 (diff) | |
download | perl-bb40f870bbd8154ddbcccd483bf0c25730deedb5.tar.gz |
utf8 substr can access memory outside PVX buffer
Message-ID: <m3iuhonl4h.fsf@furu.g.aas.no>
p4raw-id: //depot/perl@2000
-rw-r--r-- | sv.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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; |