diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-26 10:04:05 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-26 10:04:05 +0000 |
commit | 00a13d2d2808d3e6f055cd7ce9a83ebbfea37a68 (patch) | |
tree | 3650cb2c9c1bb438a422f75412e9b58f99c5fb44 /ipc/ipc_sync_channel.cc | |
parent | 1677229632b3e4410030e280f637c7d7d5c5ca31 (diff) | |
download | chromium_src-00a13d2d2808d3e6f055cd7ce9a83ebbfea37a68.zip chromium_src-00a13d2d2808d3e6f055cd7ce9a83ebbfea37a68.tar.gz chromium_src-00a13d2d2808d3e6f055cd7ce9a83ebbfea37a68.tar.bz2 |
Better handle oversized IPC messages
* Shoot down oversized messages on the sending side so we fail faster.
* Add DCHECKs to identify oversized messages early.
The real fix for the underlying bug is not to send oversized messages in the first place, but the current state of things is that it takes a long while for the renderer to crash. This change should speed the failure up a bit.
BUG=26822
TEST=Chrome should continue to load web pages.
Review URL: http://codereview.chromium.org/546047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37102 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_sync_channel.cc')
-rw-r--r-- | ipc/ipc_sync_channel.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc index 3aa7a26..5a100cf 100644 --- a/ipc/ipc_sync_channel.cc +++ b/ipc/ipc_sync_channel.cc @@ -382,6 +382,15 @@ bool SyncChannel::Send(Message* message) { } bool SyncChannel::SendWithTimeout(Message* message, int timeout_ms) { + if(message->size() > IPC::Channel::kMaximumMessageSize) { + LOG(ERROR) << "Attempt to send oversized message " + << message->size() + << " type=" + << message->type(); + delete message; + return false; + } + if (!message->is_sync()) { ChannelProxy::Send(message); return true; |