Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(707)

Side by Side Diff: mojo/public/cpp/bindings/lib/array_internal.cc

Issue 289333002: Mojo cpp bindings: validation logic for incoming messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "mojo/public/cpp/bindings/lib/array_internal.h" 5 #include "mojo/public/cpp/bindings/lib/array_internal.h"
6 6
7 namespace mojo { 7 namespace mojo {
8 namespace internal { 8 namespace internal {
9 9
10 ArrayDataTraits<bool>::BitRef::~BitRef() { 10 ArrayDataTraits<bool>::BitRef::~BitRef() {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 const ArrayHeader* header, 66 const ArrayHeader* header,
67 ElementType* elements, 67 ElementType* elements,
68 Message* message) { 68 Message* message) {
69 for (uint32_t i = 0; i < header->num_elements; ++i) { 69 for (uint32_t i = 0; i < header->num_elements; ++i) {
70 if (!DecodeHandle(&elements[i], message->mutable_handles())) 70 if (!DecodeHandle(&elements[i], message->mutable_handles()))
71 return false; 71 return false;
72 } 72 }
73 return true; 73 return true;
74 } 74 }
75 75
76 // static
77 bool ArraySerializationHelper<Handle, true>::ValidateElements(
78 const ArrayHeader* header,
79 const ElementType* elements,
80 BoundsChecker* bounds_checker) {
81 for (uint32_t i = 0; i < header->num_elements; ++i) {
82 if (!bounds_checker->ClaimHandle(elements[i]))
83 return false;
84 }
85 return true;
86 }
87
76 } // namespace internal 88 } // namespace internal
77 } // namespace mojo 89 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698