Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/loader/nacl_ipc_adapter.h" | 5 #include "components/nacl/loader/nacl_ipc_adapter.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 817 // There is some padding in this structure (the "padding" member is 16 | 817 // There is some padding in this structure (the "padding" member is 16 |
| 818 // bits but this then gets padded to 32 bits). We want to be sure not to | 818 // bits but this then gets padded to 32 bits). We want to be sure not to |
| 819 // leak data to the untrusted plugin, so zero everything out first. | 819 // leak data to the untrusted plugin, so zero everything out first. |
| 820 NaClMessageHeader header; | 820 NaClMessageHeader header; |
| 821 memset(&header, 0, sizeof(NaClMessageHeader)); | 821 memset(&header, 0, sizeof(NaClMessageHeader)); |
| 822 | 822 |
| 823 header.payload_size = static_cast<uint32>(msg.payload_size()); | 823 header.payload_size = static_cast<uint32>(msg.payload_size()); |
| 824 header.routing = msg.routing_id(); | 824 header.routing = msg.routing_id(); |
| 825 header.type = msg.type(); | 825 header.type = msg.type(); |
| 826 header.flags = msg.flags(); | 826 header.flags = msg.flags(); |
| 827 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); | 827 header.num_fds = static_cast<uint16>(rewritten_msg->desc_count()); |
|
Peter Kasting
2014/12/06 00:12:18
What if desc_count() doesn't fit in a uint16? Is
bbudge
2014/12/06 01:30:28
These messages are from the renderer or browser pr
| |
| 828 | 828 |
| 829 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); | 829 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); |
| 830 locked_data_.to_be_received_.push(rewritten_msg); | 830 locked_data_.to_be_received_.push(rewritten_msg); |
| 831 } | 831 } |
| 832 | 832 |
| 833 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { | 833 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { |
| 834 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); | 834 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); |
| 835 } | 835 } |
| OLD | NEW |