diff options
author | Dinger, Tom <unknown> | 2003-07-14 05:35:15 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-07-24 14:00:29 +0000 |
commit | 30f84f9e5679c246d4f88beeae6ff40079b53e3a (patch) | |
tree | f91ae4f9b014e74512e82d4e484c92554c5d041f /utf8.c | |
parent | 4be49ee61a2cd6ec9ba90ecf286cbb4ee1cf7e96 (diff) | |
download | perl-30f84f9e5679c246d4f88beeae6ff40079b53e3a.tar.gz |
[perl #22946] Bug in Unicode surrogate pair conversion in Perl_utf16_to_utf8
From: "Dinger, Tom" (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-22946-60715.1.00007189884266@rt.perl.org>
p4raw-id: //depot/perl@20211
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -831,7 +831,8 @@ Perl_utf16_to_utf8(pTHX_ U8* p, U8* d, I32 bytelen, I32 *newlen) continue; } if (uv >= 0xd800 && uv < 0xdbff) { /* surrogates */ - UV low = *p++; + UV low = (p[0] << 8) + p[1]; + p += 2; if (low < 0xdc00 || low >= 0xdfff) Perl_croak(aTHX_ "Malformed UTF-16 surrogate"); uv = ((uv - 0xd800) << 10) + (low - 0xdc00) + 0x10000; |