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

Side by Side Diff: net/quic/core/quic_framer.cc

Issue 2669443003: Fix unchecked return value and uninitialized field. (Closed)
Patch Set: Created 3 years, 10 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 | « AUTHORS ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/quic/core/quic_framer.h" 5 #include "net/quic/core/quic_framer.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 QuicFramer::QuicFramer(const QuicVersionVector& supported_versions, 132 QuicFramer::QuicFramer(const QuicVersionVector& supported_versions,
133 QuicTime creation_time, 133 QuicTime creation_time,
134 Perspective perspective) 134 Perspective perspective)
135 : visitor_(nullptr), 135 : visitor_(nullptr),
136 error_(QUIC_NO_ERROR), 136 error_(QUIC_NO_ERROR),
137 last_packet_number_(0), 137 last_packet_number_(0),
138 largest_packet_number_(0), 138 largest_packet_number_(0),
139 last_path_id_(kInvalidPathId), 139 last_path_id_(kInvalidPathId),
140 last_serialized_connection_id_(0), 140 last_serialized_connection_id_(0),
141 last_version_tag_(0),
141 supported_versions_(supported_versions), 142 supported_versions_(supported_versions),
142 decrypter_level_(ENCRYPTION_NONE), 143 decrypter_level_(ENCRYPTION_NONE),
143 alternative_decrypter_level_(ENCRYPTION_NONE), 144 alternative_decrypter_level_(ENCRYPTION_NONE),
144 alternative_decrypter_latch_(false), 145 alternative_decrypter_latch_(false),
145 perspective_(perspective), 146 perspective_(perspective),
146 validate_flags_(true), 147 validate_flags_(true),
147 creation_time_(creation_time), 148 creation_time_(creation_time),
148 last_timestamp_(QuicTime::Delta::Zero()) { 149 last_timestamp_(QuicTime::Delta::Zero()) {
149 DCHECK(!supported_versions.empty()); 150 DCHECK(!supported_versions.empty());
150 quic_version_ = supported_versions_[0]; 151 quic_version_ = supported_versions_[0];
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 !writer->WriteUInt64(header.public_header.connection_id)) { 690 !writer->WriteUInt64(header.public_header.connection_id)) {
690 return false; 691 return false;
691 } 692 }
692 break; 693 break;
693 } 694 }
694 last_serialized_connection_id_ = header.public_header.connection_id; 695 last_serialized_connection_id_ = header.public_header.connection_id;
695 696
696 if (header.public_header.version_flag) { 697 if (header.public_header.version_flag) {
697 DCHECK_EQ(Perspective::IS_CLIENT, perspective_); 698 DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
698 QuicTag tag = QuicVersionToQuicTag(quic_version_); 699 QuicTag tag = QuicVersionToQuicTag(quic_version_);
699 writer->WriteUInt32(tag); 700 if (!writer->WriteUInt32(tag)) {
701 return false;
702 }
700 QUIC_DVLOG(1) << ENDPOINT << "version = " << quic_version_ << ", tag = '" 703 QUIC_DVLOG(1) << ENDPOINT << "version = " << quic_version_ << ", tag = '"
701 << QuicTagToString(tag) << "'"; 704 << QuicTagToString(tag) << "'";
702 } 705 }
703 706
704 if (header.public_header.multipath_flag && 707 if (header.public_header.multipath_flag &&
705 !writer->WriteUInt8(header.path_id)) { 708 !writer->WriteUInt8(header.path_id)) {
706 return false; 709 return false;
707 } 710 }
708 711
709 if (header.public_header.nonce != nullptr && 712 if (header.public_header.nonce != nullptr &&
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 2211
2209 bool QuicFramer::RaiseError(QuicErrorCode error) { 2212 bool QuicFramer::RaiseError(QuicErrorCode error) {
2210 QUIC_DLOG(INFO) << ENDPOINT << "Error: " << QuicErrorCodeToString(error) 2213 QUIC_DLOG(INFO) << ENDPOINT << "Error: " << QuicErrorCodeToString(error)
2211 << " detail: " << detailed_error_; 2214 << " detail: " << detailed_error_;
2212 set_error(error); 2215 set_error(error);
2213 visitor_->OnError(this); 2216 visitor_->OnError(this);
2214 return false; 2217 return false;
2215 } 2218 }
2216 2219
2217 } // namespace net 2220 } // namespace net
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698