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

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

Issue 2989243002: Reject negative values for "b=AS". (Closed)
Patch Set: Created 3 years, 4 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/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 3325 matching lines...) Expand 10 before | Expand all | Expand 10 after
3336 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" 3336 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
3337 "s=-\r\n" 3337 "s=-\r\n"
3338 "t=0 0\r\n" 3338 "t=0 0\r\n"
3339 "m=video 3457 RTP/SAVPF 120\r\n" 3339 "m=video 3457 RTP/SAVPF 120\r\n"
3340 "b=AS:2147483647\r\n" 3340 "b=AS:2147483647\r\n"
3341 "foo=fail\r\n"; 3341 "foo=fail\r\n";
3342 3342
3343 ExpectParseFailure(std::string(kSdpWithLargeBandwidth), "foo=fail"); 3343 ExpectParseFailure(std::string(kSdpWithLargeBandwidth), "foo=fail");
3344 } 3344 }
3345 3345
3346 // Similar to the above, except that negative values are illegal, not just
3347 // error-prone as large values are.
3348 // https://bugs.chromium.org/p/chromium/issues/detail?id=675361
3349 TEST_F(WebRtcSdpTest, DeserializingNegativeBandwidthLimitFails) {
3350 static const char kSdpWithNegativeBandwidth[] =
3351 "v=0\r\n"
3352 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
3353 "s=-\r\n"
3354 "t=0 0\r\n"
3355 "m=video 3457 RTP/SAVPF 120\r\n"
3356 "b=AS:-1000\r\n";
3357
3358 ExpectParseFailure(std::string(kSdpWithNegativeBandwidth), "b=AS:-1000");
3359 }
3360
3346 // Test that "ufrag"/"pwd" in the candidate line itself are ignored, and only 3361 // Test that "ufrag"/"pwd" in the candidate line itself are ignored, and only
3347 // the "a=ice-ufrag"/"a=ice-pwd" attributes are used. 3362 // the "a=ice-ufrag"/"a=ice-pwd" attributes are used.
3348 // Regression test for: 3363 // Regression test for:
3349 // https://bugs.chromium.org/p/chromium/issues/detail?id=681286 3364 // https://bugs.chromium.org/p/chromium/issues/detail?id=681286
3350 TEST_F(WebRtcSdpTest, IceCredentialsInCandidateStringIgnored) { 3365 TEST_F(WebRtcSdpTest, IceCredentialsInCandidateStringIgnored) {
3351 // Important piece is "ufrag foo pwd bar". 3366 // Important piece is "ufrag foo pwd bar".
3352 static const char kSdpWithIceCredentialsInCandidateString[] = 3367 static const char kSdpWithIceCredentialsInCandidateString[] =
3353 "v=0\r\n" 3368 "v=0\r\n"
3354 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" 3369 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
3355 "s=-\r\n" 3370 "s=-\r\n"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
3538 EXPECT_TRUE(SdpDeserialize(message, &jdesc)); 3553 EXPECT_TRUE(SdpDeserialize(message, &jdesc));
3539 auto audio_desc = static_cast<cricket::MediaContentDescription*>( 3554 auto audio_desc = static_cast<cricket::MediaContentDescription*>(
3540 jdesc.description()->GetContentByName(kAudioContentName)->description); 3555 jdesc.description()->GetContentByName(kAudioContentName)->description);
3541 auto video_desc = static_cast<cricket::MediaContentDescription*>( 3556 auto video_desc = static_cast<cricket::MediaContentDescription*>(
3542 jdesc.description()->GetContentByName(kVideoContentName)->description); 3557 jdesc.description()->GetContentByName(kVideoContentName)->description);
3543 EXPECT_EQ(audio_desc_->connection_address().ToString(), 3558 EXPECT_EQ(audio_desc_->connection_address().ToString(),
3544 audio_desc->connection_address().ToString()); 3559 audio_desc->connection_address().ToString());
3545 EXPECT_EQ(video_desc_->connection_address().ToString(), 3560 EXPECT_EQ(video_desc_->connection_address().ToString(),
3546 video_desc->connection_address().ToString()); 3561 video_desc->connection_address().ToString());
3547 } 3562 }
OLDNEW
« no previous file with comments | « webrtc/pc/webrtcsdp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698