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

Unified Diff: net/quic/quic_connection_test.cc

Issue 1987523003: Consider receiving crypto frames on non crypto stream as memory corruption. Protected by FLAG_quic_… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122080193
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index 5f253ac396ecb2fa9a7d73ad6d10a0656db04416..760ef02c90927d3e383a5ff488d0e2f8f6651027 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -4963,6 +4963,43 @@ TEST_P(QuicConnectionTest, MultipleCallsToCloseConnection) {
ConnectionCloseBehavior::SILENT_CLOSE);
}
+TEST_P(QuicConnectionTest, ServerReceivesChloOnNonCryptoStream) {
+ FLAGS_quic_detect_memory_corrpution = true;
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
+
+ set_perspective(Perspective::IS_SERVER);
+ QuicPacketCreatorPeer::SetSendVersionInPacket(creator_, false);
+
+ CryptoHandshakeMessage message;
+ CryptoFramer framer;
+ message.set_tag(kCHLO);
+ std::unique_ptr<QuicData> data(framer.ConstructHandshakeMessage(message));
+ frame1_.stream_id = 10;
+ frame1_.data_buffer = data->data();
+ frame1_.data_length = data->length();
+
+ EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_MAYBE_CORRUPTED_MEMORY, _,
+ ConnectionCloseSource::FROM_SELF));
+ ProcessFramePacket(QuicFrame(&frame1_));
+}
+
+TEST_P(QuicConnectionTest, ClientReceivesRejOnNonCryptoStream) {
+ FLAGS_quic_detect_memory_corrpution = true;
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
+
+ CryptoHandshakeMessage message;
+ CryptoFramer framer;
+ message.set_tag(kREJ);
+ std::unique_ptr<QuicData> data(framer.ConstructHandshakeMessage(message));
+ frame1_.stream_id = 10;
+ frame1_.data_buffer = data->data();
+ frame1_.data_length = data->length();
+
+ EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_MAYBE_CORRUPTED_MEMORY, _,
+ ConnectionCloseSource::FROM_SELF));
+ ProcessFramePacket(QuicFrame(&frame1_));
+}
+
} // namespace
} // namespace test
} // namespace net
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698