From 9b1e66d302c7982e598a9d523a79b26ed5e2c2cc Mon Sep 17 00:00:00 2001 From: aliaspider Date: Thu, 11 May 2017 17:41:27 +0100 Subject: [PATCH] correct the mask used on the first byte in utf8_walk. fixes #4892 --- libretro-common/encodings/encoding_utf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libretro-common/encodings/encoding_utf.c b/libretro-common/encodings/encoding_utf.c index 76fca8dfb8..c4ec8fd7a8 100644 --- a/libretro-common/encodings/encoding_utf.c +++ b/libretro-common/encodings/encoding_utf.c @@ -218,10 +218,10 @@ uint32_t utf8_walk(const char **string) ret = (ret<<6) | (utf8_walkbyte(string) & 0x3F); if (first >= 0xF0) - return ret | (first&31)<<18; + return ret | (first&7)<<18; if (first >= 0xE0) return ret | (first&15)<<12; - return ret | (first&7)<<6; + return ret | (first&31)<<6; } static bool utf16_to_char(uint8_t **utf_data,