diff options
author | Cylen Yao <cylen.yao@mediatek.com> | 2014-06-11 12:41:36 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-11 12:41:36 +0000 |
commit | 3b1380385004e535c6214b8199181a055f1e21d0 (patch) | |
tree | 9eccb0d4e550ab3ab5679a2115fbcb557751f7f5 /libutils | |
parent | 9e55879f43b685d07c3c499c21cfee9a2fcd8f33 (diff) | |
parent | 72299bf0d240072174f847d13f1c9498b3ef9fa6 (diff) | |
download | system_core-3b1380385004e535c6214b8199181a055f1e21d0.zip system_core-3b1380385004e535c6214b8199181a055f1e21d0.tar.gz system_core-3b1380385004e535c6214b8199181a055f1e21d0.tar.bz2 |
am 72299bf0: [Bug]NE when playing mp3 with incorrect UTF16 char
* commit '72299bf0d240072174f847d13f1c9498b3ef9fa6':
[Bug]NE when playing mp3 with incorrect UTF16 char
Diffstat (limited to 'libutils')
-rw-r--r-- | libutils/Unicode.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libutils/Unicode.cpp b/libutils/Unicode.cpp index fe8887d..378d2a7 100644 --- a/libutils/Unicode.cpp +++ b/libutils/Unicode.cpp @@ -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; |