Title: [219943] trunk/Source/WebCore
Revision
219943
Author
[email protected]
Date
2017-07-26 06:52:35 -0700 (Wed, 26 Jul 2017)

Log Message

[WPE] Fix a potential crash in the platform pasteboard when reading a string
https://bugs.webkit.org/show_bug.cgi?id=174859

Reviewed by Žan Doberšek.

We shouldn't assume that the wpe_pasteboard_string struct will be
filled in, so initialize it.

* platform/wpe/PlatformPasteboardWPE.cpp:
(WebCore::PlatformPasteboard::readString): Initialize the struct
before passing it to wpe and early return if it's still empty.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (219942 => 219943)


--- trunk/Source/WebCore/ChangeLog	2017-07-26 13:43:25 UTC (rev 219942)
+++ trunk/Source/WebCore/ChangeLog	2017-07-26 13:52:35 UTC (rev 219943)
@@ -1,3 +1,17 @@
+2017-07-26  Claudio Saavedra  <[email protected]>
+
+        [WPE] Fix a potential crash in the platform pasteboard when reading a string
+        https://bugs.webkit.org/show_bug.cgi?id=174859
+
+        Reviewed by Žan Doberšek.
+
+        We shouldn't assume that the wpe_pasteboard_string struct will be
+        filled in, so initialize it.
+
+        * platform/wpe/PlatformPasteboardWPE.cpp:
+        (WebCore::PlatformPasteboard::readString): Initialize the struct
+        before passing it to wpe and early return if it's still empty.
+
 2017-07-26  Javier Fernandez  <[email protected]>
 
         InsertOrderedList command applied to table cells inserts an extra BR before the table

Modified: trunk/Source/WebCore/platform/wpe/PlatformPasteboardWPE.cpp (219942 => 219943)


--- trunk/Source/WebCore/platform/wpe/PlatformPasteboardWPE.cpp	2017-07-26 13:43:25 UTC (rev 219942)
+++ trunk/Source/WebCore/platform/wpe/PlatformPasteboardWPE.cpp	2017-07-26 13:52:35 UTC (rev 219943)
@@ -61,8 +61,10 @@
 
 String PlatformPasteboard::readString(int, const String& type)
 {
-    struct wpe_pasteboard_string string;
+    struct wpe_pasteboard_string string = { nullptr, 0 };
     wpe_pasteboard_get_string(m_pasteboard, type.utf8().data(), &string);
+    if (!string.length)
+        return String();
 
     String returnValue(string.data, string.length);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to