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

Side by Side Diff: webrtc/base/win32_unittest.cc

Issue 2867653002: Fixing invalid IPv6 address parsing stack underflow on Windows. (Closed)
Patch Set: Fixing issue caught by new test. Created 3 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 unified diff | Download patch
« no previous file with comments | « webrtc/base/win32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2010 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 // Test zero compression only done once. 86 // Test zero compression only done once.
87 ASSERT_TRUE(IPFromString("0:1:000:1190:0000:0001:000:01", &ipv6)); 87 ASSERT_TRUE(IPFromString("0:1:000:1190:0000:0001:000:01", &ipv6));
88 EXPECT_EQ("::1:0:1190:0:1:0:1", ipv6.ToString()); 88 EXPECT_EQ("::1:0:1190:0:1:0:1", ipv6.ToString());
89 89
90 // Make sure noncompressable IPv6 is the same. 90 // Make sure noncompressable IPv6 is the same.
91 ASSERT_TRUE(IPFromString("1234:5678:abcd:1234:5678:abcd:1234:5678", &ipv6)); 91 ASSERT_TRUE(IPFromString("1234:5678:abcd:1234:5678:abcd:1234:5678", &ipv6));
92 EXPECT_EQ("1234:5678:abcd:1234:5678:abcd:1234:5678", ipv6.ToString()); 92 EXPECT_EQ("1234:5678:abcd:1234:5678:abcd:1234:5678", ipv6.ToString());
93 } 93 }
94 94
95 // Test that invalid IPv6 addresses are recognized and false is returned.
96 TEST_F(Win32Test, InvalidIPv6AddressParsing) {
97 IPAddress ipv6;
98
99 // More than 1 run of "::"s.
100 EXPECT_FALSE(IPFromString("1::2::3", &ipv6));
101
102 // More than 1 run of "::"s in a longer address.
103 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=7592
104 EXPECT_FALSE(IPFromString("1::2::3::4::5::6::7::8", &ipv6));
105
106 // Three ':'s in a row.
107 EXPECT_FALSE(IPFromString("1:::2", &ipv6));
108
109 // Non-hex character.
110 EXPECT_FALSE(IPFromString("test::1", &ipv6));
111
112 // More than 4 hex digits per group.
113 EXPECT_FALSE(IPFromString("abcde::1", &ipv6));
114
115 // More than 8 groups.
116 EXPECT_FALSE(IPFromString("1:2:3:4:5:6:7:8:9", &ipv6));
117
118 // Less than 8 groups.
119 EXPECT_FALSE(IPFromString("1:2:3:4:5:6:7", &ipv6));
120 }
121
95 } // namespace rtc 122 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/win32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698