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

Unified Diff: mojo/edk/system/message_pipe_dispatcher.cc

Issue 1936333002: [mojo-edk] Fix uninitialized reads in EDK dispatchers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « mojo/edk/system/data_pipe_producer_dispatcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/message_pipe_dispatcher.cc
diff --git a/mojo/edk/system/message_pipe_dispatcher.cc b/mojo/edk/system/message_pipe_dispatcher.cc
index d55a3c975cea1312c2fd3c6bbbcd8435a1fa72da..6b22c90668091f2db5ecbead918c68f0672f2c2f 100644
--- a/mojo/edk/system/message_pipe_dispatcher.cc
+++ b/mojo/edk/system/message_pipe_dispatcher.cc
@@ -499,22 +499,23 @@ void MessagePipeDispatcher::OnPortStatusChanged() {
#if !defined(NDEBUG)
ports::PortStatus port_status;
- node_controller_->node()->GetStatus(port_, &port_status);
- if (port_status.has_messages) {
- ports::ScopedMessage unused;
- size_t message_size = 0;
- node_controller_->node()->GetMessageIf(
- port_, [&message_size](const ports::Message& message) {
- message_size = message.num_payload_bytes();
- return false;
- }, &unused);
- DVLOG(1) << "New message detected on message pipe " << pipe_id_
- << " endpoint " << endpoint_ << " [port=" << port_.name()
- << "; size=" << message_size << "]";
- }
- if (port_status.peer_closed) {
- DVLOG(1) << "Peer closure detected on message pipe " << pipe_id_
- << " endpoint " << endpoint_ << " [port=" << port_.name() << "]";
+ if (node_controller_->node()->GetStatus(port_, &port_status) == ports::OK) {
+ if (port_status.has_messages) {
+ ports::ScopedMessage unused;
+ size_t message_size = 0;
+ node_controller_->node()->GetMessageIf(
+ port_, [&message_size](const ports::Message& message) {
+ message_size = message.num_payload_bytes();
+ return false;
+ }, &unused);
+ DVLOG(1) << "New message detected on message pipe " << pipe_id_
+ << " endpoint " << endpoint_ << " [port=" << port_.name()
+ << "; size=" << message_size << "]";
+ }
+ if (port_status.peer_closed) {
+ DVLOG(1) << "Peer closure detected on message pipe " << pipe_id_
+ << " endpoint " << endpoint_ << " [port=" << port_.name() << "]";
+ }
}
#endif
« no previous file with comments | « mojo/edk/system/data_pipe_producer_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698