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

Side by Side Diff: mojo/system/raw_channel_posix.cc

Issue 132173003: Mojo: Fix possibly-invalid vector subscripting in RawChannelPosix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/system/raw_channel.h" 5 #include "mojo/system/raw_channel.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <string.h> 8 #include <string.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 10
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 // If we didn't max out |kReadSize|, stop reading for now. 290 // If we didn't max out |kReadSize|, stop reading for now.
291 if (static_cast<size_t>(bytes_read) < kReadSize) 291 if (static_cast<size_t>(bytes_read) < kReadSize)
292 break; 292 break;
293 293
294 // Else try to read some more.... 294 // Else try to read some more....
295 } 295 }
296 296
297 // Move data back to start. 297 // Move data back to start.
298 if (read_buffer_start > 0) { 298 if (read_buffer_start > 0) {
299 memmove(&read_buffer_[0], &read_buffer_[read_buffer_start], 299 if (read_buffer_num_valid_bytes_ > 0) {
300 read_buffer_num_valid_bytes_); 300 memmove(&read_buffer_[0], &read_buffer_[read_buffer_start],
301 read_buffer_num_valid_bytes_);
302 }
301 read_buffer_start = 0; 303 read_buffer_start = 0;
302 } 304 }
303 } 305 }
304 306
305 void RawChannelPosix::OnFileCanWriteWithoutBlocking(int fd) { 307 void RawChannelPosix::OnFileCanWriteWithoutBlocking(int fd) {
306 DCHECK_EQ(fd, fd_); 308 DCHECK_EQ(fd, fd_);
307 DCHECK_EQ(base::MessageLoop::current(), message_loop()); 309 DCHECK_EQ(base::MessageLoop::current(), message_loop());
308 310
309 bool did_fail = false; 311 bool did_fail = false;
310 { 312 {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // Static factory method declared in raw_channel.h. 403 // Static factory method declared in raw_channel.h.
402 // static 404 // static
403 RawChannel* RawChannel::Create(const PlatformChannelHandle& handle, 405 RawChannel* RawChannel::Create(const PlatformChannelHandle& handle,
404 Delegate* delegate, 406 Delegate* delegate,
405 base::MessageLoop* message_loop) { 407 base::MessageLoop* message_loop) {
406 return new RawChannelPosix(handle, delegate, message_loop); 408 return new RawChannelPosix(handle, delegate, message_loop);
407 } 409 }
408 410
409 } // namespace system 411 } // namespace system
410 } // namespace mojo 412 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698