Fix utf8 check split code point at buffer end

This commit is contained in:
Vinnie Falco
2017-08-30 17:39:24 -07:00
parent c8a42bba0a
commit 9f089c2a33
3 changed files with 95 additions and 25 deletions
@@ -173,13 +173,13 @@ write(std::uint8_t const* in, std::size_t size)
{
if(v < 128)
return 1;
if(v < 194)
if(v < 192)
return 0;
if(v < 224)
return 2;
if(v < 240)
return 3;
if(v < 245)
if(v < 248)
return 4;
return 0;
};