Title: [278761] trunk/Source/WebKit
Revision
278761
Author
commit-qu...@webkit.org
Date
2021-06-11 08:00:25 -0700 (Fri, 11 Jun 2021)

Log Message

[GTK] Crash when dragging an account node above WebView
https://bugs.webkit.org/show_bug.cgi?id=226811

Patch by Michael Catanzaro <mcatanz...@gnome.org> on 2021-06-11
Reviewed by Adrian Perez de Castro.

When we receive empty drag data, this is indicated by length -1, not by 0.

* UIProcess/API/gtk/DropTargetGtk3.cpp:
(WebKit::DropTarget::dataReceived):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (278760 => 278761)


--- trunk/Source/WebKit/ChangeLog	2021-06-11 14:25:47 UTC (rev 278760)
+++ trunk/Source/WebKit/ChangeLog	2021-06-11 15:00:25 UTC (rev 278761)
@@ -1,3 +1,15 @@
+2021-06-11  Michael Catanzaro  <mcatanz...@gnome.org>
+
+        [GTK] Crash when dragging an account node above WebView
+        https://bugs.webkit.org/show_bug.cgi?id=226811
+
+        Reviewed by Adrian Perez de Castro.
+
+        When we receive empty drag data, this is indicated by length -1, not by 0.
+
+        * UIProcess/API/gtk/DropTargetGtk3.cpp:
+        (WebKit::DropTarget::dataReceived):
+
 2021-06-11  Adrian Perez de Castro  <ape...@igalia.com>
 
         Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.33.2 release

Modified: trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp (278760 => 278761)


--- trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp	2021-06-11 14:25:47 UTC (rev 278760)
+++ trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp	2021-06-11 15:00:25 UTC (rev 278761)
@@ -177,7 +177,7 @@
     case DropTargetType::Markup: {
         gint length;
         const auto* markupData = gtk_selection_data_get_data_with_length(data, &length);
-        if (length) {
+        if (length > 0) {
             // If data starts with UTF-16 BOM assume it's UTF-16, otherwise assume UTF-8.
             if (length >= 2 && reinterpret_cast<const UChar*>(markupData)[0] == 0xFEFF)
                 m_selectionData->setMarkup(String(reinterpret_cast<const UChar*>(markupData) + 1, (length / 2) - 1));
@@ -189,7 +189,7 @@
     case DropTargetType::URIList: {
         gint length;
         const auto* uriListData = gtk_selection_data_get_data_with_length(data, &length);
-        if (length)
+        if (length > 0)
             m_selectionData->setURIList(String::fromUTF8(uriListData, length));
         break;
     }
@@ -196,7 +196,7 @@
     case DropTargetType::NetscapeURL: {
         gint length;
         const auto* urlData = gtk_selection_data_get_data_with_length(data, &length);
-        if (length) {
+        if (length > 0) {
             Vector<String> tokens = String::fromUTF8(urlData, length).split('\n');
             URL url({ }, tokens[0]);
             if (url.isValid())
@@ -210,7 +210,7 @@
     case DropTargetType::Custom: {
         int length;
         const auto* customData = gtk_selection_data_get_data_with_length(data, &length);
-        if (length)
+        if (length > 0)
             m_selectionData->setCustomData(SharedBuffer::create(customData, static_cast<size_t>(length)));
         break;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to