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

Side by Side Diff: net/quic/quic_framer_test.cc

Issue 1543703002: Drop packets which are larger than kMaxPacketSize, instead of closing the connection with QUIC_PACK… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@110286048
Patch Set: Created 4 years, 12 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_framer.cc ('k') | net/quic/quic_protocol.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_framer.h" 5 #include "net/quic/quic_framer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 630
631 memset(packet + GetPacketHeaderSize( 631 memset(packet + GetPacketHeaderSize(
632 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, !kIncludePathId, 632 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, !kIncludePathId,
633 PACKET_6BYTE_PACKET_NUMBER, NOT_IN_FEC_GROUP), 0, 633 PACKET_6BYTE_PACKET_NUMBER, NOT_IN_FEC_GROUP), 0,
634 kMaxPacketSize - GetPacketHeaderSize( 634 kMaxPacketSize - GetPacketHeaderSize(
635 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, !kIncludePathId, 635 PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, !kIncludePathId,
636 PACKET_6BYTE_PACKET_NUMBER, NOT_IN_FEC_GROUP) + 1); 636 PACKET_6BYTE_PACKET_NUMBER, NOT_IN_FEC_GROUP) + 1);
637 // clang-format on 637 // clang-format on
638 638
639 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); 639 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
640 EXPECT_FALSE(framer_.ProcessPacket(encrypted)); 640 EXPECT_DFATAL(framer_.ProcessPacket(encrypted), "Packet too large:1");
641 641
642 ASSERT_TRUE(visitor_.header_.get()); 642 ASSERT_TRUE(visitor_.header_.get());
643 // Make sure we've parsed the packet header, so we can send an error. 643 // Make sure we've parsed the packet header, so we can send an error.
644 EXPECT_EQ(kConnectionId, visitor_.header_->public_header.connection_id); 644 EXPECT_EQ(kConnectionId, visitor_.header_->public_header.connection_id);
645 // Make sure the correct error is propagated. 645 // Make sure the correct error is propagated.
646 EXPECT_EQ(QUIC_PACKET_TOO_LARGE, framer_.error()); 646 EXPECT_EQ(QUIC_PACKET_TOO_LARGE, framer_.error());
647 } 647 }
648 648
649 TEST_P(QuicFramerTest, PacketHeader) { 649 TEST_P(QuicFramerTest, PacketHeader) {
650 // clang-format off 650 // clang-format off
(...skipping 4017 matching lines...) Expand 10 before | Expand all | Expand 10 after
4668 'o', ' ', 'w', 'o', 4668 'o', ' ', 'w', 'o',
4669 'r', 'l', 'd', '!', 4669 'r', 'l', 'd', '!',
4670 }; 4670 };
4671 // clang-format on 4671 // clang-format on
4672 4672
4673 QuicFramerFuzzFunc(packet, arraysize(packet)); 4673 QuicFramerFuzzFunc(packet, arraysize(packet));
4674 } 4674 }
4675 4675
4676 } // namespace test 4676 } // namespace test
4677 } // namespace net 4677 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_framer.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698