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

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

Issue 2676293003: Fix SDP parsing crash due to missing track ID in "a=msid". (Closed)
Patch Set: Rebase 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
« no previous file with comments | « no previous file | webrtc/pc/webrtcsdp_unittest.cc » ('j') | 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 2118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 // msid-value = msid-id [ SP msid-appdata ] 2129 // msid-value = msid-id [ SP msid-appdata ]
2130 // msid-id = 1*64token-char ; see RFC 4566 2130 // msid-id = 1*64token-char ; see RFC 4566
2131 // msid-appdata = 1*64token-char ; see RFC 4566 2131 // msid-appdata = 1*64token-char ; see RFC 4566
2132 std::string field1; 2132 std::string field1;
2133 if (!rtc::tokenize_first(line.substr(kLinePrefixLength), kSdpDelimiterSpace, 2133 if (!rtc::tokenize_first(line.substr(kLinePrefixLength), kSdpDelimiterSpace,
2134 &field1, track_id)) { 2134 &field1, track_id)) {
2135 const size_t expected_fields = 2; 2135 const size_t expected_fields = 2;
2136 return ParseFailedExpectFieldNum(line, expected_fields, error); 2136 return ParseFailedExpectFieldNum(line, expected_fields, error);
2137 } 2137 }
2138 2138
2139 if (track_id->empty()) {
2140 return ParseFailed(line, "Missing track ID in msid attribute.", error);
2141 }
2142
2139 // msid:<msid-id> 2143 // msid:<msid-id>
2140 if (!GetValue(field1, kAttributeMsid, stream_id, error)) { 2144 if (!GetValue(field1, kAttributeMsid, stream_id, error)) {
2141 return false; 2145 return false;
2142 } 2146 }
2147 if (stream_id->empty()) {
2148 return ParseFailed(line, "Missing stream ID in msid attribute.", error);
2149 }
2143 return true; 2150 return true;
2144 } 2151 }
2145 2152
2146 // RFC 3551 2153 // RFC 3551
2147 // PT encoding media type clock rate channels 2154 // PT encoding media type clock rate channels
2148 // name (Hz) 2155 // name (Hz)
2149 // 0 PCMU A 8,000 1 2156 // 0 PCMU A 8,000 1
2150 // 1 reserved A 2157 // 1 reserved A
2151 // 2 reserved A 2158 // 2 reserved A
2152 // 3 GSM A 8,000 1 2159 // 3 GSM A 8,000 1
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
3205 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( 3212 UpdateCodec<AudioContentDescription, cricket::AudioCodec>(
3206 media_desc, payload_type, feedback_param); 3213 media_desc, payload_type, feedback_param);
3207 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { 3214 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) {
3208 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( 3215 UpdateCodec<VideoContentDescription, cricket::VideoCodec>(
3209 media_desc, payload_type, feedback_param); 3216 media_desc, payload_type, feedback_param);
3210 } 3217 }
3211 return true; 3218 return true;
3212 } 3219 }
3213 3220
3214 } // namespace webrtc 3221 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/pc/webrtcsdp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698