[GTK] Bad utf8 data is being passed to enchant_dict_check
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2012 17:33:29 +0000 (17:33 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2012 17:33:29 +0000 (17:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=94202

Patch by Mario Sanchez Prada <msanchez@igalia.com> on 2012-08-16
Reviewed by Martin Robinson.

Pass the number of bytes instead of the number of UTF8 characters
when calling enchant_dict_check.

* platform/text/gtk/TextCheckerEnchant.cpp:
(TextCheckerEnchant::checkSpellingOfString): Use 'bytes' instead
of 'wordLength'.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125791 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/text/gtk/TextCheckerEnchant.cpp

index 3dfa2bc..f5e0572 100644 (file)
@@ -1,3 +1,17 @@
+2012-08-16  Mario Sanchez Prada  <msanchez@igalia.com>
+
+        [GTK] Bad utf8 data is being passed to enchant_dict_check
+        https://bugs.webkit.org/show_bug.cgi?id=94202
+
+        Reviewed by Martin Robinson.
+
+        Pass the number of bytes instead of the number of UTF8 characters
+        when calling enchant_dict_check.
+
+        * platform/text/gtk/TextCheckerEnchant.cpp:
+        (TextCheckerEnchant::checkSpellingOfString): Use 'bytes' instead
+        of 'wordLength'.
+
 2012-08-16  Sergey Rogulenko  <rogulenko@google.com>
 
         Web Inspector: added Paint events for Images to TimelineAgent
index ad668ab..f3f60e6 100644 (file)
@@ -115,7 +115,7 @@ void TextCheckerEnchant::checkSpellingOfString(const String& string, int& misspe
             g_utf8_strncpy(word.get(), cstart, wordLength);
 
             for (; dictIter != m_enchantDictionaries.end(); ++dictIter) {
-                if (enchant_dict_check(*dictIter, word.get(), wordLength)) {
+                if (enchant_dict_check(*dictIter, word.get(), bytes)) {
                     misspellingLocation = start;
                     misspellingLength = wordLength;
                 } else {