Title: [230197] trunk/Source/WebCore
Revision
230197
Author
carlo...@webkit.org
Date
2018-04-03 00:11:04 -0700 (Tue, 03 Apr 2018)

Log Message

[GTK] Segfaults in enchant_broker_free_dict()
https://bugs.webkit.org/show_bug.cgi?id=183738

Reviewed by Michael Catanzaro.

Check enchant_broker_request_dict() didn't return nullptr before adding it to the m_enchantDictionaries vector.

* platform/text/enchant/TextCheckerEnchant.cpp:
(WebCore::TextCheckerEnchant::updateSpellCheckingLanguages):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (230196 => 230197)


--- trunk/Source/WebCore/ChangeLog	2018-04-03 07:09:34 UTC (rev 230196)
+++ trunk/Source/WebCore/ChangeLog	2018-04-03 07:11:04 UTC (rev 230197)
@@ -1,5 +1,17 @@
 2018-04-03  Carlos Garcia Campos  <cgar...@igalia.com>
 
+        [GTK] Segfaults in enchant_broker_free_dict()
+        https://bugs.webkit.org/show_bug.cgi?id=183738
+
+        Reviewed by Michael Catanzaro.
+
+        Check enchant_broker_request_dict() didn't return nullptr before adding it to the m_enchantDictionaries vector.
+
+        * platform/text/enchant/TextCheckerEnchant.cpp:
+        (WebCore::TextCheckerEnchant::updateSpellCheckingLanguages):
+
+2018-04-03  Carlos Garcia Campos  <cgar...@igalia.com>
+
         [GTK] NetworkProcess from WebKitGtk+ 2.19.9x SIGSEVs in NetworkStorageSession (secret search callback)
         https://bugs.webkit.org/show_bug.cgi?id=183346
 

Modified: trunk/Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp (230196 => 230197)


--- trunk/Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp	2018-04-03 07:09:34 UTC (rev 230196)
+++ trunk/Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp	2018-04-03 07:11:04 UTC (rev 230197)
@@ -140,8 +140,8 @@
         for (auto& language : languages) {
             CString currentLanguage = language.utf8();
             if (enchant_broker_dict_exists(m_broker, currentLanguage.data())) {
-                EnchantDict* dict = enchant_broker_request_dict(m_broker, currentLanguage.data());
-                spellDictionaries.append(dict);
+                if (auto* dict = enchant_broker_request_dict(m_broker, currentLanguage.data()))
+                    spellDictionaries.append(dict);
             }
         }
     } else {
@@ -149,15 +149,15 @@
         CString utf8Language = defaultLanguage().utf8();
         const char* language = utf8Language.data();
         if (enchant_broker_dict_exists(m_broker, language)) {
-            EnchantDict* dict = enchant_broker_request_dict(m_broker, language);
-            spellDictionaries.append(dict);
+            if (auto* dict = enchant_broker_request_dict(m_broker, language))
+                spellDictionaries.append(dict);
         } else {
             // No dictionaries selected, we get the first one from the list.
             Vector<CString> allDictionaries;
             enchant_broker_list_dicts(m_broker, enchantDictDescribeCallback, &allDictionaries);
             if (!allDictionaries.isEmpty()) {
-                EnchantDict* dict = enchant_broker_request_dict(m_broker, allDictionaries.first().data());
-                spellDictionaries.append(dict);
+                if (auto* dict = enchant_broker_request_dict(m_broker, allDictionaries.first().data()))
+                    spellDictionaries.append(dict);
             }
         }
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to