Skip to content

Commit

Permalink
Check whether read side is closed when reading QuicChromiumClientStream
Browse files Browse the repository at this point in the history
When quic::QuicSpdyStream receives a RST_STREAM frame it clears the
underlying read buffer. Subsequent read operations should check
quic::QuicStream::read_side_closed() so that it doesn't access the
cleared read buffer.

This CL is cloned from https://crrev.com/c/4691923 by bashi@chromium.org.

(cherry picked from commit ecf8b69)

Bug: 1465224
Change-Id: I35a908e11d09c67dea857b34653d6cf1cadbb407
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4728448
Commit-Queue: Bence Béky <bnc@chromium.org>
Auto-Submit: Bence Béky <bnc@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1176838}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4733554
Reviewed-by: Bence Béky <bnc@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5790@{#1904}
Cr-Branched-From: 1d71a33-refs/heads/main@{#1148114}
  • Loading branch information
Bence Béky authored and Chromium LUCI CQ committed Jul 31, 2023
1 parent 88edac1 commit e40cb33
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/quic/quic_chromium_client_stream.cc
Expand Up @@ -206,6 +206,10 @@ int QuicChromiumClientStream::Handle::ReadBody(
if (!stream_)
return net_error_;

if (stream_->read_side_closed()) {
return OK;
}

int rv = stream_->Read(buffer, buffer_len);
if (rv != ERR_IO_PENDING)
return rv;
Expand Down

0 comments on commit e40cb33

Please sign in to comment.