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

Side by Side Diff: mojo/edk/system/channel.h

Issue 1993963002: [mojo-edk] Better validation of untrusted message data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 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
« no previous file with comments | « no previous file | mojo/edk/system/channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef MOJO_EDK_SYSTEM_CHANNEL_H_ 5 #ifndef MOJO_EDK_SYSTEM_CHANNEL_H_
6 #define MOJO_EDK_SYSTEM_CHANNEL_H_ 6 #define MOJO_EDK_SYSTEM_CHANNEL_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 bool OnReadComplete(size_t bytes_read, size_t* next_read_size_hint); 225 bool OnReadComplete(size_t bytes_read, size_t* next_read_size_hint);
226 226
227 // Called by the implementation when something goes horribly wrong. It is NOT 227 // Called by the implementation when something goes horribly wrong. It is NOT
228 // OK to call this synchronously from any public interface methods. 228 // OK to call this synchronously from any public interface methods.
229 void OnError(); 229 void OnError();
230 230
231 // Retrieves the set of platform handles read for a given message. 231 // Retrieves the set of platform handles read for a given message.
232 // |extra_header| and |extra_header_size| correspond to the extra header data. 232 // |extra_header| and |extra_header_size| correspond to the extra header data.
233 // Depending on the Channel implementation, this body may encode platform 233 // Depending on the Channel implementation, this body may encode platform
234 // handles, or handles may be stored and managed elsewhere by the 234 // handles, or handles may be stored and managed elsewhere by the
235 // implementation. If |num_handles| handles cannot be returned, this must 235 // implementation.
236 // return null. 236 //
237 virtual ScopedPlatformHandleVectorPtr GetReadPlatformHandles( 237 // Returns |false| on unrecoverable error (i.e. the Channel should be closed).
238 // Returns |true| otherwise. Note that it is possible on some platforms for an
239 // insufficient number of handles to be available when this call is made, but
240 // this is not necessarily an error condition. In such cases this returns
241 // |true| but |*handles| will also be reset to null.
242 virtual bool GetReadPlatformHandles(
238 size_t num_handles, 243 size_t num_handles,
239 const void* extra_header, 244 const void* extra_header,
240 size_t extra_header_size) = 0; 245 size_t extra_header_size,
246 ScopedPlatformHandleVectorPtr* handles) = 0;
241 247
242 virtual void OnControlMessage(Message::Header::MessageType message_type, 248 // Handles a received control message. Returns |true| if the message is
249 // accepted, or |false| otherwise.
250 virtual bool OnControlMessage(Message::Header::MessageType message_type,
243 const void* payload, 251 const void* payload,
244 size_t payload_size, 252 size_t payload_size,
245 ScopedPlatformHandleVectorPtr handles) {} 253 ScopedPlatformHandleVectorPtr handles);
246 254
247 private: 255 private:
248 friend class base::RefCountedThreadSafe<Channel>; 256 friend class base::RefCountedThreadSafe<Channel>;
249 257
250 class ReadBuffer; 258 class ReadBuffer;
251 259
252 Delegate* delegate_; 260 Delegate* delegate_;
253 const scoped_ptr<ReadBuffer> read_buffer_; 261 const scoped_ptr<ReadBuffer> read_buffer_;
254 262
255 DISALLOW_COPY_AND_ASSIGN(Channel); 263 DISALLOW_COPY_AND_ASSIGN(Channel);
256 }; 264 };
257 265
258 } // namespace edk 266 } // namespace edk
259 } // namespace mojo 267 } // namespace mojo
260 268
261 #endif // MOJO_EDK_SYSTEM_CHANNEL_H_ 269 #endif // MOJO_EDK_SYSTEM_CHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698