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: net/quic/quic_spdy_stream.cc

Issue 1975483003: Fixes use-after-free bug in QUIC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Removes use of QuicHeaderList from merge CL. 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_spdy_stream.h ('k') | net/quic/reliable_quic_stream_test.cc » ('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 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 "net/quic/quic_spdy_stream.h" 5 #include "net/quic/quic_spdy_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "net/quic/quic_bug_tracker.h" 9 #include "net/quic/quic_bug_tracker.h"
10 #include "net/quic/quic_spdy_session.h" 10 #include "net/quic/quic_spdy_session.h"
(...skipping 20 matching lines...) Expand all
31 priority_(kDefaultPriority), 31 priority_(kDefaultPriority),
32 trailers_decompressed_(false) { 32 trailers_decompressed_(false) {
33 DCHECK_NE(kCryptoStreamId, id); 33 DCHECK_NE(kCryptoStreamId, id);
34 // Don't receive any callbacks from the sequencer until headers 34 // Don't receive any callbacks from the sequencer until headers
35 // are complete. 35 // are complete.
36 sequencer()->SetBlockedUntilFlush(); 36 sequencer()->SetBlockedUntilFlush();
37 spdy_session_->RegisterStreamPriority(id, priority_); 37 spdy_session_->RegisterStreamPriority(id, priority_);
38 } 38 }
39 39
40 QuicSpdyStream::~QuicSpdyStream() { 40 QuicSpdyStream::~QuicSpdyStream() {
41 spdy_session_->UnregisterStreamPriority(id()); 41 if (spdy_session_ != nullptr) {
42 spdy_session_->UnregisterStreamPriority(id());
43 }
42 } 44 }
43 45
44 void QuicSpdyStream::CloseWriteSide() { 46 void QuicSpdyStream::CloseWriteSide() {
45 if (version() > QUIC_VERSION_28 && !fin_received() && !rst_received() && 47 if (version() > QUIC_VERSION_28 && !fin_received() && !rst_received() &&
46 sequencer()->ignore_read_data() && !rst_sent()) { 48 sequencer()->ignore_read_data() && !rst_sent()) {
47 DCHECK(fin_sent()); 49 DCHECK(fin_sent());
48 // Tell the peer to stop sending further data. 50 // Tell the peer to stop sending further data.
49 DVLOG(1) << ENDPOINT << "Send QUIC_STREAM_NO_ERROR on stream " << id(); 51 DVLOG(1) << ENDPOINT << "Send QUIC_STREAM_NO_ERROR on stream " << id();
50 Reset(QUIC_STREAM_NO_ERROR); 52 Reset(QUIC_STREAM_NO_ERROR);
51 } 53 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 bool QuicSpdyStream::FinishedReadingTrailers() const { 296 bool QuicSpdyStream::FinishedReadingTrailers() const {
295 // If no further trailing headers are expected, and the decompressed trailers 297 // If no further trailing headers are expected, and the decompressed trailers
296 // (if any) have been consumed, then reading of trailers is finished. 298 // (if any) have been consumed, then reading of trailers is finished.
297 bool no_more_trailers = fin_received() || trailers_decompressed_; 299 bool no_more_trailers = fin_received() || trailers_decompressed_;
298 return no_more_trailers && decompressed_trailers_.empty(); 300 return no_more_trailers && decompressed_trailers_.empty();
299 } 301 }
300 302
301 SpdyPriority QuicSpdyStream::priority() const { 303 SpdyPriority QuicSpdyStream::priority() const {
302 return priority_; 304 return priority_;
303 } 305 }
306
307 void QuicSpdyStream::ClearSession() {
308 spdy_session_ = nullptr;
309 }
310
304 } // namespace net 311 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_spdy_stream.h ('k') | net/quic/reliable_quic_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698