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

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
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)
Anand Mistry (off Chromium) 2016/05/03 05:51:54 Now debug and non-debug builds have different sema
Ken Rockot(use gerrit already) 2016/05/03 06:16:15 Good catch, fixed
503 return;
504
503 if (port_status.has_messages) { 505 if (port_status.has_messages) {
504 ports::ScopedMessage unused; 506 ports::ScopedMessage unused;
505 size_t message_size = 0; 507 size_t message_size = 0;
506 node_controller_->node()->GetMessageIf( 508 node_controller_->node()->GetMessageIf(
507 port_, [&message_size](const ports::Message& message) { 509 port_, [&message_size](const ports::Message& message) {
508 message_size = message.num_payload_bytes(); 510 message_size = message.num_payload_bytes();
509 return false; 511 return false;
510 }, &unused); 512 }, &unused);
511 DVLOG(1) << "New message detected on message pipe " << pipe_id_ 513 DVLOG(1) << "New message detected on message pipe " << pipe_id_
512 << " endpoint " << endpoint_ << " [port=" << port_.name() 514 << " endpoint " << endpoint_ << " [port=" << port_.name()
513 << "; size=" << message_size << "]"; 515 << "; size=" << message_size << "]";
514 } 516 }
515 if (port_status.peer_closed) { 517 if (port_status.peer_closed) {
516 DVLOG(1) << "Peer closure detected on message pipe " << pipe_id_ 518 DVLOG(1) << "Peer closure detected on message pipe " << pipe_id_
517 << " endpoint " << endpoint_ << " [port=" << port_.name() << "]"; 519 << " endpoint " << endpoint_ << " [port=" << port_.name() << "]";
518 } 520 }
519 #endif 521 #endif
520 522
521 awakables_.AwakeForStateChange(GetHandleSignalsStateNoLock()); 523 awakables_.AwakeForStateChange(GetHandleSignalsStateNoLock());
522 } 524 }
523 525
524 } // namespace edk 526 } // namespace edk
525 } // namespace mojo 527 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698