[Bug]NE when playing mp3 with incorrect UTF16 char
Bug: 15274351 Bug: 15539240 Many MP3 files have incorrect utf16 chars, but the Utf16_to_utf8_length() routine checks for errors in standard utf16 char. utf16_to_utf8() was not checking for errors in standard utf16 char. Change-Id: Iafd922ff92cabe6bba8971215fcfd1fd471c894b (cherry picked from commit 605b139cdf56364c6c9b37e59dd12efc61c24631)
This commit is contained in:
parent
c24b98c7d8
commit
72299bf0d2
1 changed files with 2 additions and 1 deletions
|
@ -342,7 +342,8 @@ void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst)
|
|||
while (cur_utf16 < end_utf16) {
|
||||
char32_t utf32;
|
||||
// surrogate pairs
|
||||
if ((*cur_utf16 & 0xFC00) == 0xD800) {
|
||||
if((*cur_utf16 & 0xFC00) == 0xD800 && (cur_utf16 + 1) < end_utf16
|
||||
&& (*(cur_utf16 + 1) & 0xFC00) == 0xDC00) {
|
||||
utf32 = (*cur_utf16++ - 0xD800) << 10;
|
||||
utf32 |= *cur_utf16++ - 0xDC00;
|
||||
utf32 += 0x10000;
|
||||
|
|
Loading…
Reference in a new issue