summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGisle Aas <gisle@aas.no>1998-10-14 02:38:06 +0200
committerGurusamy Sarathy <gsar@cpan.org>1998-10-17 03:06:33 +0000
commitbb40f870bbd8154ddbcccd483bf0c25730deedb5 (patch)
tree91d1ec2166d76ed485e00ce2918ffd16202fcd30
parentc1441b1036cd8cd94473c6ac4ca8b480bfe1e4e2 (diff)
downloadperl-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.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index ad38a8762e..97a07909c7 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;