Fixed potential issue in Obfuscator on illegal UTF-8 source #2518

This commit is contained in:
Alexey Milovidov 2018-06-30 02:27:56 +03:00
parent 33205bba92
commit 394b020869

View File

@ -503,8 +503,11 @@ private:
CodePoint readCodePoint(const char *& pos, const char * end)
{
size_t length = UTF8::seqLength(*pos);
if (pos + length > end)
length = end - pos;
if (length > sizeof(CodePoint))
length = sizeof(CodePoint);
CodePoint res = 0;
memcpy(&res, pos, length);