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

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

Issue 2571073002: Fixing integer overflow when parsing bandwidth attribute. (Closed)
Patch Set: Making code more readable. 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
« no previous file with comments | « webrtc/api/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 3183 matching lines...) Expand 10 before | Expand all | Expand 10 after
3194 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" 3194 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
3195 "s=-\r\n" 3195 "s=-\r\n"
3196 "t=0 0\r\n" 3196 "t=0 0\r\n"
3197 "m=video 9 UDP/DTLS/SCTP 120\r\n" 3197 "m=video 9 UDP/DTLS/SCTP 120\r\n"
3198 "a=sctp-port 5000\r\n" 3198 "a=sctp-port 5000\r\n"
3199 "a=fmtp:108 foo=10\r\n"; 3199 "a=fmtp:108 foo=10\r\n";
3200 3200
3201 ExpectParseFailure(std::string(kSdpWithSctpPortInVideoDescription), 3201 ExpectParseFailure(std::string(kSdpWithSctpPortInVideoDescription),
3202 "sctp-port"); 3202 "sctp-port");
3203 } 3203 }
3204
3205 // Regression test for integer overflow bug:
3206 // https://bugs.chromium.org/p/chromium/issues/detail?id=648071
3207 TEST_F(WebRtcSdpTest, DeserializeLargeBandwidthLimit) {
3208 JsepSessionDescription jdesc_output(kDummyString);
3209
3210 // Bandwidth attribute is the max signed 32-bit int, which will get
3211 // multiplied by 1000 and cause int overflow if not careful.
3212 const char kSdpWithLargeBandwidth[] =
3213 "v=0\r\n"
3214 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
3215 "s=-\r\n"
3216 "t=0 0\r\n"
3217 "m=video 3457 RTP/SAVPF 120\r\n"
3218 "b=AS:2147483647\r\n"
3219 "foo=fail\r\n";
3220
3221 ExpectParseFailure(std::string(kSdpWithLargeBandwidth), "foo=fail");
3222 }
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsdp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698