| Auto-Submit | +1 |
| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
base::WeakPtr<XDragDropClient> alive = weak_factory_.GetWeakPtr();Can swap with the next line and have a narrower scope.
EXPECT_EQ(delegate.client(), nullptr);`EXPECT_FALSE(delegate.client());`. Similarly for the next test case.
EXPECT_NE(delegate.client(), nullptr);Needs to be ASSERT_TRUE() to avoid potentially crashing on the next line.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +0 |
| Commit-Queue | +2 |
base::WeakPtr<XDragDropClient> alive = weak_factory_.GetWeakPtr();Can swap with the next line and have a narrower scope.
Done
`EXPECT_FALSE(delegate.client());`. Similarly for the next test case.
Done
Needs to be ASSERT_TRUE() to avoid potentially crashing on the next line.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
2 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: ui/ozone/platform/x11/test/x11_drag_drop_client_unittest.cc
Insertions: 3, Deletions: 3.
@@ -1017,7 +1017,7 @@
delegate.destroy_during_update_drag_ = true;
DriveSelectionNotifyPath(delegate.client(), static_cast<x11::Window>(1));
- EXPECT_EQ(delegate.client(), nullptr);
+ EXPECT_FALSE(delegate.client());
}
TEST_F(X11DragDropClientTest,
@@ -1028,8 +1028,8 @@
delegate.SetClient(std::move(client));
DriveSelectionNotifyPath(delegate.client(), static_cast<x11::Window>(1));
- EXPECT_NE(delegate.client(), nullptr);
- EXPECT_EQ(delegate.client()->target_current_context(), nullptr);
+ ASSERT_TRUE(delegate.client());
+ EXPECT_FALSE(delegate.client()->target_current_context());
}
} // namespace ui
```
```
The name of the file: ui/base/x/x11_drag_drop_client.cc
Insertions: 4, Deletions: 5.
@@ -479,13 +479,12 @@
void XDragDropClient::OnSelectionNotify(
const x11::SelectionNotifyEvent& xselection) {
DVLOG(1) << "OnSelectionNotify";
- base::WeakPtr<XDragDropClient> alive = weak_factory_.GetWeakPtr();
if (target_current_context_) {
+ base::WeakPtr<XDragDropClient> alive = weak_factory_.GetWeakPtr();
target_current_context_->OnSelectionNotify(xselection);
- }
-
- if (!alive) {
- return;
+ if (!alive) {
+ return;
+ }
}
// ICCCM requires us to delete the property passed into SelectionNotify.
```
[X11] Fix UAF in XDragContext and XDragDropClient during XDND events
During nested run loop execution triggered by drag-and-drop delegates,
re-entrant events (e.g. XdndLeave or window closure) can destroy the
active XDragContext or its parent XDragDropClient. Upon returning to
outer stack frames, this leads to unguarded UAF access.
This CL fixes this by:
1. Clearing `drag_drop_client_` and snapshotting it before calling
`CompleteXdndPosition()` in
`XDragContext::RequestNextTargetOrComplete()`. This ensures that no
member of `this` is accessed after the re-entrant loop returns.
2. Using a `WeakPtr` guard in `XDragDropClient::OnSelectionNotify()`
to avoid accessing the freed client when deleting the selection
property.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |