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

Side by Side 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, 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 | « mojo/edk/system/data_pipe_producer_dispatcher.cc ('k') | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/edk/system/message_pipe_dispatcher.h" 5 #include "mojo/edk/system/message_pipe_dispatcher.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 base::AutoLock lock(signal_lock_); 492 base::AutoLock lock(signal_lock_);
493 493
494 // We stop observing our port as soon as it's transferred, but this can race 494 // We stop observing our port as soon as it's transferred, but this can race
495 // with events which are raised right before that happens. This is fine to 495 // with events which are raised right before that happens. This is fine to
496 // ignore. 496 // ignore.
497 if (port_transferred_) 497 if (port_transferred_)
498 return; 498 return;
499 499
500 #if !defined(NDEBUG) 500 #if !defined(NDEBUG)
501 ports::PortStatus port_status; 501 ports::PortStatus port_status;
502 node_controller_->node()->GetStatus(port_, &port_status); 502 if (node_controller_->node()->GetStatus(port_, &port_status) == ports::OK) {
503 if (port_status.has_messages) { 503 if (port_status.has_messages) {
504 ports::ScopedMessage unused; 504 ports::ScopedMessage unused;
505 size_t message_size = 0; 505 size_t message_size = 0;
506 node_controller_->node()->GetMessageIf( 506 node_controller_->node()->GetMessageIf(
507 port_, [&message_size](const ports::Message& message) { 507 port_, [&message_size](const ports::Message& message) {
508 message_size = message.num_payload_bytes(); 508 message_size = message.num_payload_bytes();
509 return false; 509 return false;
510 }, &unused); 510 }, &unused);
511 DVLOG(1) << "New message detected on message pipe " << pipe_id_ 511 DVLOG(1) << "New message detected on message pipe " << pipe_id_
512 << " endpoint " << endpoint_ << " [port=" << port_.name() 512 << " endpoint " << endpoint_ << " [port=" << port_.name()
513 << "; size=" << message_size << "]"; 513 << "; size=" << message_size << "]";
514 } 514 }
515 if (port_status.peer_closed) { 515 if (port_status.peer_closed) {
516 DVLOG(1) << "Peer closure detected on message pipe " << pipe_id_ 516 DVLOG(1) << "Peer closure detected on message pipe " << pipe_id_
517 << " endpoint " << endpoint_ << " [port=" << port_.name() << "]"; 517 << " endpoint " << endpoint_ << " [port=" << port_.name() << "]";
518 }
518 } 519 }
519 #endif 520 #endif
520 521
521 awakables_.AwakeForStateChange(GetHandleSignalsStateNoLock()); 522 awakables_.AwakeForStateChange(GetHandleSignalsStateNoLock());
522 } 523 }
523 524
524 } // namespace edk 525 } // namespace edk
525 } // namespace mojo 526 } // namespace mojo
OLDNEW
« 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