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

Side by Side Diff: webrtc/pc/webrtcsdp_unittest.cc

Issue 2675273003: Fixing SDP parsing crash due to invalid port numbers. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« webrtc/pc/webrtcsdp.cc ('K') | « webrtc/pc/webrtcsdp.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 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2011 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 3406 matching lines...) Expand 10 before | Expand all | Expand 10 after
3417 JsepSessionDescription jdesc_output(kDummyString); 3417 JsepSessionDescription jdesc_output(kDummyString);
3418 EXPECT_TRUE( 3418 EXPECT_TRUE(
3419 SdpDeserialize(kSdpWithIceCredentialsInCandidateString, &jdesc_output)); 3419 SdpDeserialize(kSdpWithIceCredentialsInCandidateString, &jdesc_output));
3420 const IceCandidateCollection* candidates = jdesc_output.candidates(0); 3420 const IceCandidateCollection* candidates = jdesc_output.candidates(0);
3421 ASSERT_NE(nullptr, candidates); 3421 ASSERT_NE(nullptr, candidates);
3422 ASSERT_EQ(1, candidates->count()); 3422 ASSERT_EQ(1, candidates->count());
3423 cricket::Candidate c = candidates->at(0)->candidate(); 3423 cricket::Candidate c = candidates->at(0)->candidate();
3424 EXPECT_EQ("ufrag_voice", c.username()); 3424 EXPECT_EQ("ufrag_voice", c.username());
3425 EXPECT_EQ("pwd_voice", c.password()); 3425 EXPECT_EQ("pwd_voice", c.password());
3426 } 3426 }
3427
3428 // Test that SDP with an invalid port number in "a=candidate" lines is
3429 // rejected, without crashing.
3430 // Regression test for:
3431 // https://bugs.chromium.org/p/chromium/issues/detail?id=677029
3432 TEST_F(WebRtcSdpTest, DeserializeInvalidPortInCandidateAttribute) {
3433 static const char kSdpWithInvalidCandidatePort[] =
3434 "v=0\r\n"
3435 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
3436 "s=-\r\n"
3437 "t=0 0\r\n"
3438 "m=audio 9 RTP/SAVPF 111\r\n"
3439 "c=IN IP4 0.0.0.0\r\n"
3440 "a=rtcp:9 IN IP4 0.0.0.0\r\n"
3441 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n"
3442 "a=rtpmap:111 opus/48000/2\r\n"
3443 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 12345678 typ host "
3444 "generation 2 raddr 192.168.1.1 rport 87654321\r\n";
3445
3446 JsepSessionDescription jdesc_output(kDummyString);
3447 EXPECT_FALSE(SdpDeserialize(kSdpWithInvalidCandidatePort, &jdesc_output));
3448 }
OLDNEW
« webrtc/pc/webrtcsdp.cc ('K') | « webrtc/pc/webrtcsdp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698