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

Unified Diff: mojo/edk/system/child_broker.cc

Issue 1537593002: Fix UAF in new Mojo EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improve comment Created 5 years 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 | « mojo/edk/system/broker_state.cc ('k') | mojo/edk/system/message_pipe_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/child_broker.cc
diff --git a/mojo/edk/system/child_broker.cc b/mojo/edk/system/child_broker.cc
index d686e74229ed765654e29ebea81af63344bf4cdd..703f2adbf1d6dbdedeb971bbcd84587002197d9a 100644
--- a/mojo/edk/system/child_broker.cc
+++ b/mojo/edk/system/child_broker.cc
@@ -272,7 +272,9 @@ void ChildBroker::AttachMessagePipe(MessagePipeDispatcher* message_pipe,
// then when it's read it returns no messages because it doesn't have the
// channel yet.
message_pipe->GotNonTransferableChannel(raw_channel->channel());
- raw_channel->AddRoute(pipe_id, message_pipe);
+ // The above call could have caused |CloseMessagePipe| to be called.
+ if (connected_pipes_.find(message_pipe) != connected_pipes_.end())
+ raw_channel->AddRoute(pipe_id, message_pipe);
}
#if defined(OS_WIN)
« no previous file with comments | « mojo/edk/system/broker_state.cc ('k') | mojo/edk/system/message_pipe_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698