| Index: mojo/edk/system/message_pipe_dispatcher.cc
|
| diff --git a/mojo/edk/system/message_pipe_dispatcher.cc b/mojo/edk/system/message_pipe_dispatcher.cc
|
| index f27336b56f4d074a0e5e32ec2a592fcccff363a3..6963ec2463b33aac47c5214d7af28cf03579205d 100644
|
| --- a/mojo/edk/system/message_pipe_dispatcher.cc
|
| +++ b/mojo/edk/system/message_pipe_dispatcher.cc
|
| @@ -286,8 +286,10 @@ MojoResult MessagePipeDispatcher::ReadMessage(
|
| &no_space, &invalid_message);
|
| int rv = node_controller_->node()->GetMessage(port_, &ports_message, &filter);
|
|
|
| - if (invalid_message)
|
| + if (invalid_message) {
|
| + NOTREACHED();
|
| return MOJO_RESULT_UNKNOWN;
|
| + }
|
|
|
| if (rv != ports::OK && rv != ports::ERROR_PORT_PEER_CLOSED) {
|
| if (rv == ports::ERROR_PORT_UNKNOWN ||
|
| @@ -327,8 +329,10 @@ MojoResult MessagePipeDispatcher::ReadMessage(
|
| const DispatcherHeader* dispatcher_headers =
|
| reinterpret_cast<const DispatcherHeader*>(header + 1);
|
|
|
| - if (header->num_dispatchers > std::numeric_limits<uint16_t>::max())
|
| + if (header->num_dispatchers > std::numeric_limits<uint16_t>::max()) {
|
| + NOTREACHED();
|
| return MOJO_RESULT_UNKNOWN;
|
| + }
|
|
|
| // Deserialize dispatchers.
|
| if (header->num_dispatchers > 0) {
|
| @@ -336,8 +340,10 @@ MojoResult MessagePipeDispatcher::ReadMessage(
|
| std::vector<DispatcherInTransit> dispatchers(header->num_dispatchers);
|
| size_t data_payload_index = sizeof(MessageHeader) +
|
| header->num_dispatchers * sizeof(DispatcherHeader);
|
| - if (data_payload_index > header->header_size)
|
| + if (data_payload_index > header->header_size) {
|
| + NOTREACHED();
|
| return MOJO_RESULT_UNKNOWN;
|
| + }
|
| const char* dispatcher_data = reinterpret_cast<const char*>(
|
| dispatcher_headers + header->num_dispatchers);
|
| size_t port_index = 0;
|
| @@ -351,17 +357,21 @@ MojoResult MessagePipeDispatcher::ReadMessage(
|
| size_t next_payload_index = data_payload_index + dh.num_bytes;
|
| if (msg->num_payload_bytes() < next_payload_index ||
|
| next_payload_index < data_payload_index) {
|
| + NOTREACHED();
|
| return MOJO_RESULT_UNKNOWN;
|
| }
|
|
|
| size_t next_port_index = port_index + dh.num_ports;
|
| - if (msg->num_ports() < next_port_index || next_port_index < port_index)
|
| + if (msg->num_ports() < next_port_index || next_port_index < port_index) {
|
| + NOTREACHED();
|
| return MOJO_RESULT_UNKNOWN;
|
| + }
|
|
|
| size_t next_platform_handle_index =
|
| platform_handle_index + dh.num_platform_handles;
|
| if (num_msg_handles < next_platform_handle_index ||
|
| next_platform_handle_index < platform_handle_index) {
|
| + NOTREACHED();
|
| return MOJO_RESULT_UNKNOWN;
|
| }
|
|
|
| @@ -371,8 +381,10 @@ MojoResult MessagePipeDispatcher::ReadMessage(
|
| dispatchers[i].dispatcher = Dispatcher::Deserialize(
|
| type, dispatcher_data, dh.num_bytes, msg->ports() + port_index,
|
| dh.num_ports, out_handles, dh.num_platform_handles);
|
| - if (!dispatchers[i].dispatcher)
|
| + if (!dispatchers[i].dispatcher) {
|
| + NOTREACHED();
|
| return MOJO_RESULT_UNKNOWN;
|
| + }
|
|
|
| dispatcher_data += dh.num_bytes;
|
| data_payload_index = next_payload_index;
|
| @@ -381,8 +393,10 @@ MojoResult MessagePipeDispatcher::ReadMessage(
|
| }
|
|
|
| if (!node_controller_->core()->AddDispatchersFromTransit(dispatchers,
|
| - handles))
|
| + handles)) {
|
| + NOTREACHED();
|
| return MOJO_RESULT_UNKNOWN;
|
| + }
|
| }
|
|
|
| CHECK(msg);
|
|
|