From da5a85d14794d92d93de406790d923f098c9e200 Mon Sep 17 00:00:00 2001 From: anders_k Date: Sun, 18 May 2014 14:41:45 +0000 Subject: [PATCH] Better UTF8_GetTrailCount handling of start bytes outside the RFC 3629 range git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6483 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/utf.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/utf.h b/Source/utf.h index 9bf48d15..3577782e 100644 --- a/Source/utf.h +++ b/Source/utf.h @@ -65,12 +65,13 @@ inline bool UTF8_GetTrailCount(unsigned char chFirst, unsigned char &cb) if (0xF8 == (0xF8 & chFirst)) { ++cb; - if (0xFC == (0xFE & chFirst)) ++cb; else return false; + if (0xFC == (0xFE & chFirst)) ++cb; else return 0xFC >= (0xFE & chFirst); } } } + return true; } - return true; + return (signed char)chFirst >= 0; } inline UINT InlineStrLenUTF16(const void*str)