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

Side by Side Diff: remoting/host/desktop_session_agent.cc

Issue 12390027: Crash the network or desktop process when an unknown IPC message is received. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/desktop_session_agent.h" 5 #include "remoting/host/desktop_session_agent.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "ipc/ipc_channel_proxy.h" 9 #include "ipc/ipc_channel_proxy.h"
10 #include "ipc/ipc_message.h" 10 #include "ipc/ipc_message.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 IPC_MESSAGE_UNHANDLED(handled = false) 96 IPC_MESSAGE_UNHANDLED(handled = false)
97 IPC_END_MESSAGE_MAP() 97 IPC_END_MESSAGE_MAP()
98 } else { 98 } else {
99 IPC_BEGIN_MESSAGE_MAP(DesktopSessionAgent, message) 99 IPC_BEGIN_MESSAGE_MAP(DesktopSessionAgent, message)
100 IPC_MESSAGE_HANDLER(ChromotingNetworkDesktopMsg_StartSessionAgent, 100 IPC_MESSAGE_HANDLER(ChromotingNetworkDesktopMsg_StartSessionAgent,
101 OnStartSessionAgent) 101 OnStartSessionAgent)
102 IPC_MESSAGE_UNHANDLED(handled = false) 102 IPC_MESSAGE_UNHANDLED(handled = false)
103 IPC_END_MESSAGE_MAP() 103 IPC_END_MESSAGE_MAP()
104 } 104 }
105 105
106 // Close the channel if the received message wasn't expected. 106 CHECK(handled) << "An unexpected IPC message received: type="
107 if (!handled) { 107 << message.type();
108 LOG(ERROR) << "An unexpected IPC message received: type=" << message.type();
109 OnChannelError();
110 }
111
112 return handled; 108 return handled;
113 } 109 }
114 110
115 void DesktopSessionAgent::OnChannelConnected(int32 peer_pid) { 111 void DesktopSessionAgent::OnChannelConnected(int32 peer_pid) {
116 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 112 DCHECK(caller_task_runner()->BelongsToCurrentThread());
117 113
118 VLOG(1) << "IPC: desktop <- network (" << peer_pid << ")"; 114 VLOG(1) << "IPC: desktop <- network (" << peer_pid << ")";
119 115
120 CloseDesktopPipeHandle(); 116 CloseDesktopPipeHandle();
121 } 117 }
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 base::ClosePlatformFile(desktop_pipe_.fd); 527 base::ClosePlatformFile(desktop_pipe_.fd);
532 #else // !defined(OS_POSIX) 528 #else // !defined(OS_POSIX)
533 #error Unsupported platform. 529 #error Unsupported platform.
534 #endif // !defined(OS_POSIX) 530 #endif // !defined(OS_POSIX)
535 531
536 desktop_pipe_ = IPC::InvalidPlatformFileForTransit(); 532 desktop_pipe_ = IPC::InvalidPlatformFileForTransit();
537 } 533 }
538 } 534 }
539 535
540 } // namespace remoting 536 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698