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

Side by Side Diff: mojo/edk/system/data_pipe_producer_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 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/edk/system/data_pipe_producer_dispatcher.h" 5 #include "mojo/edk/system/data_pipe_producer_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 size_t previous_capacity = available_capacity_; 496 size_t previous_capacity = available_capacity_;
497 497
498 ports::PortStatus port_status; 498 ports::PortStatus port_status;
499 if (node_controller_->node()->GetStatus(control_port_, &port_status) != 499 if (node_controller_->node()->GetStatus(control_port_, &port_status) !=
500 ports::OK || 500 ports::OK ||
501 !port_status.receiving_messages) { 501 !port_status.receiving_messages) {
502 DVLOG(1) << "Data pipe producer " << pipe_id_ << " is aware of peer closure" 502 DVLOG(1) << "Data pipe producer " << pipe_id_ << " is aware of peer closure"
503 << " [control_port=" << control_port_.name() << "]"; 503 << " [control_port=" << control_port_.name() << "]";
504 504
505 peer_closed_ = true; 505 peer_closed_ = true;
506 } 506 } else {
507
508 if (port_status.has_messages && !in_transit_) {
509 ports::ScopedMessage message; 507 ports::ScopedMessage message;
510 do { 508 do {
511 int rv = node_controller_->node()->GetMessageIf(control_port_, nullptr, 509 int rv = node_controller_->node()->GetMessageIf(control_port_, nullptr,
512 &message); 510 &message);
513 if (rv != ports::OK) 511 if (rv != ports::OK)
514 peer_closed_ = true; 512 peer_closed_ = true;
515 if (message) { 513 if (message) {
516 PortsMessage* ports_message = static_cast<PortsMessage*>(message.get()); 514 PortsMessage* ports_message = static_cast<PortsMessage*>(message.get());
517 const DataPipeControlMessage* m = 515 const DataPipeControlMessage* m =
518 static_cast<const DataPipeControlMessage*>( 516 static_cast<const DataPipeControlMessage*>(
(...skipping 21 matching lines...) Expand all
540 } 538 }
541 539
542 if (peer_closed_ != was_peer_closed || 540 if (peer_closed_ != was_peer_closed ||
543 available_capacity_ != previous_capacity) { 541 available_capacity_ != previous_capacity) {
544 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); 542 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock());
545 } 543 }
546 } 544 }
547 545
548 } // namespace edk 546 } // namespace edk
549 } // namespace mojo 547 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698