Limit the amount of incoming crypto data that will be buffered.
gfe-relnote: protected by disabled flag-protected QUIC_VERSION_48
PiperOrigin-RevId: 266019141
Change-Id: Ife996bdf80a28b3bcce4b02cda49bff0fd23a071
diff --git a/quic/core/quic_crypto_stream_test.cc b/quic/core/quic_crypto_stream_test.cc
index 9d3bda5..af5a8cc 100644
--- a/quic/core/quic_crypto_stream_test.cc
+++ b/quic/core/quic_crypto_stream_test.cc
@@ -570,6 +570,23 @@
EXPECT_FALSE(stream_->HasBufferedCryptoFrames());
}
+TEST_F(QuicCryptoStreamTest, LimitBufferedCryptoData) {
+ if (!QuicVersionUsesCryptoFrames(connection_->transport_version())) {
+ return;
+ }
+
+ EXPECT_CALL(*connection_,
+ CloseConnection(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA, _, _));
+ std::string large_frame(2 * GetQuicFlag(FLAGS_quic_max_buffered_crypto_bytes),
+ 'a');
+
+ // Set offset to 1 so that we guarantee the data gets buffered instead of
+ // immediately processed.
+ QuicStreamOffset offset = 1;
+ stream_->OnCryptoFrame(
+ QuicCryptoFrame(ENCRYPTION_INITIAL, offset, large_frame));
+}
+
} // namespace
} // namespace test
} // namespace quic