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

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

Issue 229683005: Validate MessageHeader before using (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove debug printfs 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
« no previous file with comments | « mojo/public/c/test_support/test_support.h ('k') | mojo/public/cpp/bindings/lib/message.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 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/connector.h" 5 #include "mojo/public/cpp/bindings/lib/connector.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "mojo/public/cpp/bindings/error_handler.h" 10 #include "mojo/public/cpp/bindings/error_handler.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 MOJO_WAIT_FLAG_READABLE, 107 MOJO_WAIT_FLAG_READABLE,
108 MOJO_DEADLINE_INDEFINITE, 108 MOJO_DEADLINE_INDEFINITE,
109 &Connector::CallOnHandleReady, 109 &Connector::CallOnHandleReady,
110 this); 110 this);
111 } 111 }
112 112
113 void Connector::ReadMore() { 113 void Connector::ReadMore() {
114 while (true) { 114 while (true) {
115 MojoResult rv; 115 MojoResult rv;
116 116
117 rv = ReadAndDispatchMessage(message_pipe_.get(), incoming_receiver_, NULL); 117 bool receiver_result;
118 rv = ReadAndDispatchMessage(message_pipe_.get(), incoming_receiver_,
119 &receiver_result);
118 if (rv == MOJO_RESULT_SHOULD_WAIT) { 120 if (rv == MOJO_RESULT_SHOULD_WAIT) {
119 WaitToReadMore(); 121 WaitToReadMore();
120 break; 122 break;
121 } 123 }
122 if (rv != MOJO_RESULT_OK) { 124 if (rv != MOJO_RESULT_OK || !receiver_result) {
123 error_ = true; 125 error_ = true;
124 break; 126 break;
125 } 127 }
126 } 128 }
127 } 129 }
128 130
129 } // namespace internal 131 } // namespace internal
130 } // namespace mojo 132 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/c/test_support/test_support.h ('k') | mojo/public/cpp/bindings/lib/message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698