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

Patch by Michael Catanzaro <mcatanzaro@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):

Canonical link: https://commits.webkit.org/238721@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278761 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mcatanzaro authored and webkit-commit-queue committed Jun 11, 2021
1 parent 3ccef4d commit 15155fb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
@@ -1,3 +1,15 @@
2021-06-11 Michael Catanzaro <mcatanzaro@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 <aperez@igalia.com>

Unreviewed. Update OptionsWPE.cmake and NEWS for the 2.33.2 release
@@ -177,7 +177,7 @@ void DropTarget::dataReceived(IntPoint&& position, GtkSelectionData* data, unsig
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,14 +189,14 @@ void DropTarget::dataReceived(IntPoint&& position, GtkSelectionData* data, unsig
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;
}
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 @@ void DropTarget::dataReceived(IntPoint&& position, GtkSelectionData* data, unsig
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;
}

0 comments on commit 15155fb

Please sign in to comment.