OLD | NEW |
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/core/quic_framer.h" | 5 #include "net/quic/core/quic_framer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "net/quic/core/crypto/null_decrypter.h" | 17 #include "net/quic/core/crypto/null_decrypter.h" |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 // clang-format on | 635 // clang-format on |
636 | 636 |
637 const size_t header_size = GetPacketHeaderSize( | 637 const size_t header_size = GetPacketHeaderSize( |
638 framer_.version(), PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, | 638 framer_.version(), PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, |
639 !kIncludePathId, !kIncludeDiversificationNonce, | 639 !kIncludePathId, !kIncludeDiversificationNonce, |
640 PACKET_6BYTE_PACKET_NUMBER); | 640 PACKET_6BYTE_PACKET_NUMBER); |
641 | 641 |
642 memset(packet + header_size, 0, kMaxPacketSize - header_size); | 642 memset(packet + header_size, 0, kMaxPacketSize - header_size); |
643 | 643 |
644 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); | 644 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); |
645 EXPECT_DFATAL(framer_.ProcessPacket(encrypted), "Packet too large:1"); | 645 EXPECT_QUIC_BUG(framer_.ProcessPacket(encrypted), "Packet too large:1"); |
646 | 646 |
647 ASSERT_TRUE(visitor_.header_.get()); | 647 ASSERT_TRUE(visitor_.header_.get()); |
648 // Make sure we've parsed the packet header, so we can send an error. | 648 // Make sure we've parsed the packet header, so we can send an error. |
649 EXPECT_EQ(kConnectionId, visitor_.header_->public_header.connection_id); | 649 EXPECT_EQ(kConnectionId, visitor_.header_->public_header.connection_id); |
650 // Make sure the correct error is propagated. | 650 // Make sure the correct error is propagated. |
651 EXPECT_EQ(QUIC_PACKET_TOO_LARGE, framer_.error()); | 651 EXPECT_EQ(QUIC_PACKET_TOO_LARGE, framer_.error()); |
652 } | 652 } |
653 | 653 |
654 TEST_P(QuicFramerTest, PacketHeader) { | 654 TEST_P(QuicFramerTest, PacketHeader) { |
655 // clang-format off | 655 // clang-format off |
(...skipping 6531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7187 'o', ' ', 'w', 'o', | 7187 'o', ' ', 'w', 'o', |
7188 'r', 'l', 'd', '!', | 7188 'r', 'l', 'd', '!', |
7189 }; | 7189 }; |
7190 // clang-format on | 7190 // clang-format on |
7191 | 7191 |
7192 QuicFramerFuzzFunc(packet, arraysize(packet)); | 7192 QuicFramerFuzzFunc(packet, arraysize(packet)); |
7193 } | 7193 } |
7194 | 7194 |
7195 } // namespace test | 7195 } // namespace test |
7196 } // namespace net | 7196 } // namespace net |
OLD | NEW |