| 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 a1bd1d02ede9664ca12d2a7dd2f0aa736fd50b06..23e5a3fb47dd0bbb478d78ba2d41d10242d15364 100644
|
| --- a/mojo/edk/system/message_pipe_dispatcher.cc
|
| +++ b/mojo/edk/system/message_pipe_dispatcher.cc
|
| @@ -289,6 +289,8 @@ MojoResult MessagePipeDispatcher::ReadMessage(
|
| dispatcher_headers + header->num_dispatchers);
|
| size_t port_index = 0;
|
| size_t platform_handle_index = 0;
|
| + ScopedPlatformHandleVectorPtr msg_handles = msg->TakeHandles();
|
| + const size_t num_msg_handles = msg_handles ? msg_handles->size() : 0;
|
| for (size_t i = 0; i < header->num_dispatchers; ++i) {
|
| const DispatcherHeader& dh = dispatcher_headers[i];
|
| Type type = static_cast<Type>(dh.type);
|
| @@ -305,13 +307,14 @@ MojoResult MessagePipeDispatcher::ReadMessage(
|
|
|
| size_t next_platform_handle_index =
|
| platform_handle_index + dh.num_platform_handles;
|
| - if (msg->num_handles() < next_platform_handle_index ||
|
| + if (num_msg_handles < next_platform_handle_index ||
|
| next_platform_handle_index < platform_handle_index) {
|
| return MOJO_RESULT_UNKNOWN;
|
| }
|
|
|
| PlatformHandle* out_handles =
|
| - msg->num_handles() ? msg->handles() + platform_handle_index : nullptr;
|
| + num_msg_handles ? msg_handles->data() + platform_handle_index
|
| + : nullptr;
|
| dispatchers[i].dispatcher = Dispatcher::Deserialize(
|
| type, dispatcher_data, dh.num_bytes, msg->ports() + port_index,
|
| dh.num_ports, out_handles, dh.num_platform_handles);
|
|
|