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

Unified Diff: net/spdy/spdy_framer_test.cc

Issue 12258006: Minor change in parsing of GOAWAY frames for correctness. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/spdy/spdy_framer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_framer_test.cc
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
index f671b5f09df73bf097a6e8bddac6fa47dceabc9f..ceea1d389f5bd8bdbca8d523817c6a0fcd416ba7 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -3559,4 +3559,34 @@ TEST_P(SpdyFramerTest, SettingsFlagsAndId) {
EXPECT_EQ(kWireFormat, id_and_flags.GetWireFormat(spdy_version_));
}
+// Tests handling of a GOAWAY frame with out-of-bounds stream ID.
+TEST_P(SpdyFramerTest, GoAwayStreamIdBounds) {
+ const unsigned char kV2FrameData[] = {
+ 0x80, spdy_version_, 0x00, 0x07,
+ 0x00, 0x00, 0x00, 0x04,
+ 0xff, 0xff, 0xff, 0xff,
+ };
+ const unsigned char kV3FrameData[] = {
+ 0x80, spdy_version_, 0x00, 0x07,
+ 0x00, 0x00, 0x00, 0x08,
+ 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00,
+ };
+
+ testing::StrictMock<net::test::MockVisitor> visitor;
+ SpdyFramer framer(spdy_version_);
+ framer.set_visitor(&visitor);
+
+ EXPECT_CALL(visitor, OnGoAway(0x7fffffff, GOAWAY_OK));
+ if (IsSpdy2()) {
+ framer.ProcessInput(reinterpret_cast<const char*>(kV2FrameData),
+ arraysize(kV2FrameData));
+ } else {
+ framer.ProcessInput(reinterpret_cast<const char*>(kV3FrameData),
+ arraysize(kV3FrameData));
+ }
+ EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state());
+ EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code());
+}
+
} // namespace net
« no previous file with comments | « net/spdy/spdy_framer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698