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

Side by Side Diff: net/quic/quic_spdy_session.cc

Issue 1932653002: Fixes use-after-free bug in QUIC. (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 | « net/quic/quic_session_test.cc ('k') | net/quic/quic_spdy_stream.h » ('j') | 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "net/quic/quic_spdy_session.h" 5 #include "net/quic/quic_spdy_session.h"
6 6
7 #include "net/quic/quic_bug_tracker.h" 7 #include "net/quic/quic_bug_tracker.h"
8 #include "net/quic/quic_headers_stream.h" 8 #include "net/quic/quic_headers_stream.h"
9 9
10 using base::StringPiece; 10 using base::StringPiece;
11 using std::string; 11 using std::string;
12 12
13 namespace net { 13 namespace net {
14 14
15 QuicSpdySession::QuicSpdySession(QuicConnection* connection, 15 QuicSpdySession::QuicSpdySession(QuicConnection* connection,
16 const QuicConfig& config) 16 const QuicConfig& config)
17 : QuicSession(connection, config) {} 17 : QuicSession(connection, config) {}
18 18
19 QuicSpdySession::~QuicSpdySession() {} 19 QuicSpdySession::~QuicSpdySession() {
20 // Set the streams' session pointers in closed and dynamic stream lists
21 // to null to avoid subsequent use of this session.
22 for (auto const& stream : *closed_streams()) {
23 static_cast<QuicSpdyStream*>(stream)->ClearSession();
24 }
25 for (auto const& kv : dynamic_streams()) {
26 static_cast<QuicSpdyStream*>(kv.second)->ClearSession();
27 }
28 }
20 29
21 void QuicSpdySession::Initialize() { 30 void QuicSpdySession::Initialize() {
22 QuicSession::Initialize(); 31 QuicSession::Initialize();
23 32
24 if (perspective() == Perspective::IS_SERVER) { 33 if (perspective() == Perspective::IS_SERVER) {
25 set_largest_peer_created_stream_id(kHeadersStreamId); 34 set_largest_peer_created_stream_id(kHeadersStreamId);
26 } else { 35 } else {
27 QuicStreamId headers_stream_id = GetNextOutgoingStreamId(); 36 QuicStreamId headers_stream_id = GetNextOutgoingStreamId();
28 DCHECK_EQ(headers_stream_id, kHeadersStreamId); 37 DCHECK_EQ(headers_stream_id, kHeadersStreamId);
29 } 38 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 147
139 void QuicSpdySession::OnConfigNegotiated() { 148 void QuicSpdySession::OnConfigNegotiated() {
140 QuicSession::OnConfigNegotiated(); 149 QuicSession::OnConfigNegotiated();
141 if (FLAGS_quic_disable_hpack_dynamic_table && 150 if (FLAGS_quic_disable_hpack_dynamic_table &&
142 config()->HasClientSentConnectionOption(kDHDT, perspective())) { 151 config()->HasClientSentConnectionOption(kDHDT, perspective())) {
143 headers_stream_->DisableHpackDynamicTable(); 152 headers_stream_->DisableHpackDynamicTable();
144 } 153 }
145 } 154 }
146 155
147 } // namespace net 156 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session_test.cc ('k') | net/quic/quic_spdy_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698