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

Side by Side Diff: webrtc/api/peerconnection_unittest.cc

Issue 2556783002: Fix out of bound reads in ParseIceServerUrl() for various input. (Closed)
Patch Set: ParseIceServerUrl(): Clarify invalid transport parameter key error message. Created 4 years 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
« webrtc/api/peerconnection.cc ('K') | « webrtc/api/peerconnection.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 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 2731 matching lines...) Expand 10 before | Expand all | Expand 10 after
2742 EXPECT_EQ(1U, turn_servers_.size()); 2742 EXPECT_EQ(1U, turn_servers_.size());
2743 EXPECT_EQ(cricket::PROTO_TCP, turn_servers_[0].ports[0].proto); 2743 EXPECT_EQ(cricket::PROTO_TCP, turn_servers_[0].ports[0].proto);
2744 turn_servers_.clear(); 2744 turn_servers_.clear();
2745 2745
2746 EXPECT_TRUE(ParseUrl("turn:hostname?transport=udp")); 2746 EXPECT_TRUE(ParseUrl("turn:hostname?transport=udp"));
2747 EXPECT_EQ(1U, turn_servers_.size()); 2747 EXPECT_EQ(1U, turn_servers_.size());
2748 EXPECT_EQ(cricket::PROTO_UDP, turn_servers_[0].ports[0].proto); 2748 EXPECT_EQ(cricket::PROTO_UDP, turn_servers_[0].ports[0].proto);
2749 turn_servers_.clear(); 2749 turn_servers_.clear();
2750 2750
2751 EXPECT_FALSE(ParseUrl("turn:hostname?transport=invalid")); 2751 EXPECT_FALSE(ParseUrl("turn:hostname?transport=invalid"));
2752 EXPECT_FALSE(ParseUrl("turn:hostname?transport="));
2753 EXPECT_FALSE(ParseUrl("turn:hostname?="));
2754 EXPECT_FALSE(ParseUrl("?"));
2752 } 2755 }
2753 2756
2754 // Test parsing ICE username contained in URL. 2757 // Test parsing ICE username contained in URL.
2755 TEST_F(IceServerParsingTest, ParseUsername) { 2758 TEST_F(IceServerParsingTest, ParseUsername) {
2756 EXPECT_TRUE(ParseUrl("turn:user@hostname")); 2759 EXPECT_TRUE(ParseUrl("turn:user@hostname"));
2757 EXPECT_EQ(1U, turn_servers_.size()); 2760 EXPECT_EQ(1U, turn_servers_.size());
2758 EXPECT_EQ("user", turn_servers_[0].credentials.username); 2761 EXPECT_EQ("user", turn_servers_[0].credentials.username);
2759 turn_servers_.clear(); 2762 turn_servers_.clear();
2760 2763
2761 EXPECT_FALSE(ParseUrl("turn:@hostname")); 2764 EXPECT_FALSE(ParseUrl("turn:@hostname"));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2794 server.urls.push_back("turn:hostname2"); 2797 server.urls.push_back("turn:hostname2");
2795 servers.push_back(server); 2798 servers.push_back(server);
2796 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); 2799 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_));
2797 EXPECT_EQ(2U, turn_servers_.size()); 2800 EXPECT_EQ(2U, turn_servers_.size());
2798 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); 2801 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority);
2799 } 2802 }
2800 2803
2801 #endif // if !defined(THREAD_SANITIZER) 2804 #endif // if !defined(THREAD_SANITIZER)
2802 2805
2803 } // namespace 2806 } // namespace
OLDNEW
« webrtc/api/peerconnection.cc ('K') | « webrtc/api/peerconnection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698