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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/raw_channel_posix.cc
diff --git a/mojo/system/raw_channel_posix.cc b/mojo/system/raw_channel_posix.cc
index 0038afbd2ba8ab08e9363a0e9b28d0557e31abc3..fa9d5f29239dddb1bc99bc9ba4522916fefb35d7 100644
--- a/mojo/system/raw_channel_posix.cc
+++ b/mojo/system/raw_channel_posix.cc
@@ -296,8 +296,10 @@ void RawChannelPosix::OnFileCanReadWithoutBlocking(int fd) {
// Move data back to start.
if (read_buffer_start > 0) {
- memmove(&read_buffer_[0], &read_buffer_[read_buffer_start],
- read_buffer_num_valid_bytes_);
+ if (read_buffer_num_valid_bytes_ > 0) {
+ memmove(&read_buffer_[0], &read_buffer_[read_buffer_start],
+ read_buffer_num_valid_bytes_);
+ }
read_buffer_start = 0;
}
}
« 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