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

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

Issue 1985523002: [mojo-edk] Better validation of untrusted message data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 bool OnReadComplete(size_t bytes_read, size_t* next_read_size_hint); 240 bool OnReadComplete(size_t bytes_read, size_t* next_read_size_hint);
241 241
242 // Called by the implementation when something goes horribly wrong. It is NOT 242 // Called by the implementation when something goes horribly wrong. It is NOT
243 // OK to call this synchronously from any public interface methods. 243 // OK to call this synchronously from any public interface methods.
244 void OnError(); 244 void OnError();
245 245
246 // Retrieves the set of platform handles read for a given message. 246 // Retrieves the set of platform handles read for a given message.
247 // |extra_header| and |extra_header_size| correspond to the extra header data. 247 // |extra_header| and |extra_header_size| correspond to the extra header data.
248 // Depending on the Channel implementation, this body may encode platform 248 // Depending on the Channel implementation, this body may encode platform
249 // handles, or handles may be stored and managed elsewhere by the 249 // handles, or handles may be stored and managed elsewhere by the
250 // implementation. If |num_handles| handles cannot be returned, this must 250 // implementation.
251 // return null. 251 //
252 virtual ScopedPlatformHandleVectorPtr GetReadPlatformHandles( 252 // Returns |false| on unrecoverable error (i.e. the Channel should be closed).
253 // Returns |true| otherwise. Note that it is possible on some platforms for an
254 // insufficient number of handles to be available when this call is made, but
255 // this is not necessarily an error condition. In such cases this returns
256 // |true| but |*handles| will also be reset to null.
257 virtual bool GetReadPlatformHandles(
253 size_t num_handles, 258 size_t num_handles,
254 const void* extra_header, 259 const void* extra_header,
255 size_t extra_header_size) = 0; 260 size_t extra_header_size,
261 ScopedPlatformHandleVectorPtr* handles) = 0;
256 262
257 virtual void OnControlMessage(Message::Header::MessageType message_type, 263 // Handles a received control message. Returns |true| if the message is
264 // accepted, or |false| otherwise.
265 virtual bool OnControlMessage(Message::Header::MessageType message_type,
258 const void* payload, 266 const void* payload,
259 size_t payload_size, 267 size_t payload_size,
260 ScopedPlatformHandleVectorPtr handles) {} 268 ScopedPlatformHandleVectorPtr handles);
261 269
262 private: 270 private:
263 friend class base::RefCountedThreadSafe<Channel>; 271 friend class base::RefCountedThreadSafe<Channel>;
264 272
265 class ReadBuffer; 273 class ReadBuffer;
266 274
267 Delegate* delegate_; 275 Delegate* delegate_;
268 const std::unique_ptr<ReadBuffer> read_buffer_; 276 const std::unique_ptr<ReadBuffer> read_buffer_;
269 277
270 DISALLOW_COPY_AND_ASSIGN(Channel); 278 DISALLOW_COPY_AND_ASSIGN(Channel);
271 }; 279 };
272 280
273 } // namespace edk 281 } // namespace edk
274 } // namespace mojo 282 } // namespace mojo
275 283
276 #endif // MOJO_EDK_SYSTEM_CHANNEL_H_ 284 #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