diff options
Diffstat (limited to 'ipc/ipc_channel_win.cc')
-rw-r--r-- | ipc/ipc_channel_win.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc index 701bce8..788a2aa 100644 --- a/ipc/ipc_channel_win.cc +++ b/ipc/ipc_channel_win.cc @@ -77,6 +77,15 @@ void Channel::ChannelImpl::Close() { bool Channel::ChannelImpl::Send(Message* message) { DCHECK(thread_check_->CalledOnValidThread()); + if (message->size() > kMaximumMessageSize) { + LOG(ERROR) << "Attempt to send oversized message " + << message->size() + << " type=" + << message->type(); + Close(); + delete message; + return false; + } #ifdef IPC_MESSAGE_DEBUG_EXTRA DLOG(INFO) << "sending message @" << message << " on channel @" << this << " with type " << message->type() @@ -345,6 +354,11 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages( // Write to pipe... Message* m = output_queue_.front(); + + // Oversized messages should be rejected in Send(). + DCHECK_LE(m->size(), kMaximumMessageSize) + << "Attempt to send oversized message"; + BOOL ok = WriteFile(pipe_, m->data(), m->size(), |