Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: ipc/ipc_sync_message_filter.cc

Issue 2772983002: Make sure channel-associated interface pointers are always safe to call. (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/ipc_channel_mojo.cc ('k') | mojo/public/cpp/bindings/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_sync_message_filter.cc
diff --git a/ipc/ipc_sync_message_filter.cc b/ipc/ipc_sync_message_filter.cc
index ffccff3d50889271ac0b4c0926b10f62eb9e4ea8..b9737fd29379b6dcfc640e4a764fef1684b16efd 100644
--- a/ipc/ipc_sync_message_filter.cc
+++ b/ipc/ipc_sync_message_filter.cc
@@ -276,8 +276,13 @@ void SyncMessageFilter::GetGenericRemoteAssociatedInterface(
mojo::ScopedInterfaceEndpointHandle handle) {
base::AutoLock auto_lock(lock_);
DCHECK(io_task_runner_ && io_task_runner_->BelongsToCurrentThread());
- if (!channel_)
+ if (!channel_) {
+ // Attach the associated interface to a disconnected pipe, so that the
+ // associated interface pointer can be used to make calls (which are
+ // dropped).
+ mojo::GetIsolatedInterface(std::move(handle));
return;
+ }
Channel::AssociatedInterfaceSupport* support =
channel_->GetAssociatedInterfaceSupport();
« no previous file with comments | « ipc/ipc_channel_mojo.cc ('k') | mojo/public/cpp/bindings/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698