correct the mask used on the first byte in utf8_walk. fixes #4892

This commit is contained in:
aliaspider 2017-05-11 17:41:27 +01:00
parent 2ce9d71553
commit 9b1e66d302

View File

@ -218,10 +218,10 @@ uint32_t utf8_walk(const char **string)
ret = (ret<<6) | (utf8_walkbyte(string) & 0x3F); ret = (ret<<6) | (utf8_walkbyte(string) & 0x3F);
if (first >= 0xF0) if (first >= 0xF0)
return ret | (first&31)<<18; return ret | (first&7)<<18;
if (first >= 0xE0) if (first >= 0xE0)
return ret | (first&15)<<12; return ret | (first&15)<<12;
return ret | (first&7)<<6; return ret | (first&31)<<6;
} }
static bool utf16_to_char(uint8_t **utf_data, static bool utf16_to_char(uint8_t **utf_data,