summaryrefslogtreecommitdiffstats
path: root/mojo/edk/system/platform_handle_dispatcher.cc
diff options
context:
space:
mode:
authorlhchavez <lhchavez@chromium.org>2016-01-08 16:47:54 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-09 00:49:12 +0000
commit41bc841af01d297a6d337a62a195cd4080dc7639 (patch)
treef5723e7e53f58ce707d655329753787d441064dc /mojo/edk/system/platform_handle_dispatcher.cc
parent7e642027bde0962b5ff5ee85fe6b3cd61fef7fd5 (diff)
downloadchromium_src-41bc841af01d297a6d337a62a195cd4080dc7639.zip
chromium_src-41bc841af01d297a6d337a62a195cd4080dc7639.tar.gz
chromium_src-41bc841af01d297a6d337a62a195cd4080dc7639.tar.bz2
mojo: Fix the size of several platform-specific structs
Having SerializedPlatformHandleDispatcher::platform_handle_index (and other platform-specific structs) be a size_t causes 64-bit processes communicating with 32-bit processes to fail the size check. This change fixes the size of |platform_handle_index| (and similar ones) so it is fixed across platforms (to uint32_t) so that the error goes away. BUG=574945 TEST=32-bit ARC communication works in 64-bit Chrome OS Review URL: https://codereview.chromium.org/1568693002 Cr-Commit-Position: refs/heads/master@{#368488}
Diffstat (limited to 'mojo/edk/system/platform_handle_dispatcher.cc')
-rw-r--r--mojo/edk/system/platform_handle_dispatcher.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/mojo/edk/system/platform_handle_dispatcher.cc b/mojo/edk/system/platform_handle_dispatcher.cc
index ab0ac12..eadcb8e 100644
--- a/mojo/edk/system/platform_handle_dispatcher.cc
+++ b/mojo/edk/system/platform_handle_dispatcher.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <algorithm>
+#include <limits>
#include <utility>
#include "base/logging.h"
@@ -16,10 +17,10 @@ namespace edk {
namespace {
-const size_t kInvalidPlatformHandleIndex = static_cast<size_t>(-1);
+const uint32_t kInvalidPlatformHandleIndex = static_cast<uint32_t>(-1);
struct MOJO_ALIGNAS(8) SerializedPlatformHandleDispatcher {
- size_t platform_handle_index; // (Or |kInvalidPlatformHandleIndex|.)
+ uint32_t platform_handle_index; // (Or |kInvalidPlatformHandleIndex|.)
};
} // namespace
@@ -98,7 +99,9 @@ bool PlatformHandleDispatcher::EndSerializeAndCloseImplNoLock(
SerializedPlatformHandleDispatcher* serialization =
static_cast<SerializedPlatformHandleDispatcher*>(destination);
if (platform_handle_.is_valid()) {
- serialization->platform_handle_index = platform_handles->size();
+ DCHECK(platform_handles->size() < std::numeric_limits<uint32_t>::max());
+ serialization->platform_handle_index =
+ static_cast<uint32_t>(platform_handles->size());
platform_handles->push_back(platform_handle_.release());
} else {
serialization->platform_handle_index = kInvalidPlatformHandleIndex;