| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_util.h" | 5 #include "mojo/public/cpp/bindings/lib/validation_util.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serializati
on.h" | 9 #include "mojo/public/cpp/bindings/lib/bindings_serialization.h" |
| 10 #include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_internal.h" | 10 #include "mojo/public/cpp/bindings/lib/message_internal.h" |
| 11 #include "third_party/mojo/src/mojo/public/cpp/bindings/lib/validation_errors.h" | 11 #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| 12 #include "third_party/mojo/src/mojo/public/interfaces/bindings/interface_control
_messages.mojom.h" | 12 #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 bool ValidateEncodedPointer(const uint64_t* offset) { | 17 bool ValidateEncodedPointer(const uint64_t* offset) { |
| 18 // - Make sure |*offset| is no more than 32-bits. | 18 // - Make sure |*offset| is no more than 32-bits. |
| 19 // - Cast |offset| to uintptr_t so overflow behavior is well defined across | 19 // - Cast |offset| to uintptr_t so overflow behavior is well defined across |
| 20 // 32-bit and 64-bit systems. | 20 // 32-bit and 64-bit systems. |
| 21 return *offset <= std::numeric_limits<uint32_t>::max() && | 21 return *offset <= std::numeric_limits<uint32_t>::max() && |
| 22 (reinterpret_cast<uintptr_t>(offset) + | 22 (reinterpret_cast<uintptr_t>(offset) + |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 return false; | 94 return false; |
| 95 switch (message->header()->name) { | 95 switch (message->header()->name) { |
| 96 case kRunMessageId: | 96 case kRunMessageId: |
| 97 return ValidateMessagePayload<RunResponseMessageParams_Data>(message); | 97 return ValidateMessagePayload<RunResponseMessageParams_Data>(message); |
| 98 } | 98 } |
| 99 return false; | 99 return false; |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace internal | 102 } // namespace internal |
| 103 } // namespace mojo | 103 } // namespace mojo |
| OLD | NEW |