From 03a0d5845160f5e890db47e09fcdba8e79546c4a Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 9 Aug 2008 21:38:21 +0000 Subject: [PATCH] more strict UTF-8 validity checks, as it should be (patch #9847) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55036 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/stringops.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/common/stringops.cpp b/src/common/stringops.cpp index b4959f846c..9ccd34d95c 100644 --- a/src/common/stringops.cpp +++ b/src/common/stringops.cpp @@ -131,7 +131,16 @@ bool wxStringOperationsUtf8::IsValidUtf8String(const char *str, size_t len) if ( !(b >= 0x80 && b <= 0xBF ) ) return false; } - else if ( b <= 0xEF ) // E1..EF + else if ( b == 0xED ) + { + b = *(++c); + if ( !(b >= 0x80 && b <= 0x9F ) ) + return false; + b = *(++c); + if ( !(b >= 0x80 && b <= 0xBF ) ) + return false; + } + else if ( b <= 0xEF ) // E1..EC EE..EF { for ( int i = 0; i < 2; ++i ) { -- 2.50.0