summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-18 22:01:49 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-18 22:10:36 +0100
commitdbde19516d139ef4237fc56ac1a14665a9f13c0b (patch)
tree24eeaeb461811abc2fa36561ae01d8aabb1524eb /utf8.c
parent01ea242be7d23d3bfac7a37c0cdfaec0a8eb7e33 (diff)
downloadperl-dbde19516d139ef4237fc56ac1a14665a9f13c0b.tar.gz
utf16_to_utf8() should croak on encountering a bare low surrogate.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index 4a728aa09a..3e4451b10a 100644
--- a/utf8.c
+++ b/utf8.c
@@ -995,6 +995,8 @@ Perl_utf16_to_utf8(pTHX_ U8* p, U8* d, I32 bytelen, I32 *newlen)
Perl_croak(aTHX_ "Malformed UTF-16 surrogate");
uv = ((uv - 0xd800) << 10) + (low - 0xdc00) + 0x10000;
}
+ } else if (uv >= 0xdc00 && uv <= 0xdfff) {
+ Perl_croak(aTHX_ "Malformed UTF-16 surrogate");
}
if (uv < 0x10000) {
*d++ = (U8)(( uv >> 12) | 0xe0);