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

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: 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') | webrtc/pc/webrtcsdp_unittest.cc » ('J')
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 2104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2115 // msid-value = msid-id [ SP msid-appdata ] 2115 // msid-value = msid-id [ SP msid-appdata ]
2116 // msid-id = 1*64token-char ; see RFC 4566 2116 // msid-id = 1*64token-char ; see RFC 4566
2117 // msid-appdata = 1*64token-char ; see RFC 4566 2117 // msid-appdata = 1*64token-char ; see RFC 4566
2118 std::string field1; 2118 std::string field1;
2119 if (!rtc::tokenize_first(line.substr(kLinePrefixLength), kSdpDelimiterSpace, 2119 if (!rtc::tokenize_first(line.substr(kLinePrefixLength), kSdpDelimiterSpace,
2120 &field1, track_id)) { 2120 &field1, track_id)) {
2121 const size_t expected_fields = 2; 2121 const size_t expected_fields = 2;
2122 return ParseFailedExpectFieldNum(line, expected_fields, error); 2122 return ParseFailedExpectFieldNum(line, expected_fields, error);
2123 } 2123 }
2124 2124
2125 if (track_id->empty()) {
2126 return ParseFailed(line, "Missing track ID in msid attribute.", error);
2127 }
2128
2125 // msid:<msid-id> 2129 // msid:<msid-id>
2126 if (!GetValue(field1, kAttributeMsid, stream_id, error)) { 2130 if (!GetValue(field1, kAttributeMsid, stream_id, error)) {
2127 return false; 2131 return false;
2128 } 2132 }
2133 if (stream_id->empty()) {
2134 return ParseFailed(line, "Missing stream ID in msid attribute.", error);
2135 }
2129 return true; 2136 return true;
2130 } 2137 }
2131 2138
2132 // RFC 3551 2139 // RFC 3551
2133 // PT encoding media type clock rate channels 2140 // PT encoding media type clock rate channels
2134 // name (Hz) 2141 // name (Hz)
2135 // 0 PCMU A 8,000 1 2142 // 0 PCMU A 8,000 1
2136 // 1 reserved A 2143 // 1 reserved A
2137 // 2 reserved A 2144 // 2 reserved A
2138 // 3 GSM A 8,000 1 2145 // 3 GSM A 8,000 1
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
3191 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( 3198 UpdateCodec<AudioContentDescription, cricket::AudioCodec>(
3192 media_desc, payload_type, feedback_param); 3199 media_desc, payload_type, feedback_param);
3193 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { 3200 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) {
3194 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( 3201 UpdateCodec<VideoContentDescription, cricket::VideoCodec>(
3195 media_desc, payload_type, feedback_param); 3202 media_desc, payload_type, feedback_param);
3196 } 3203 }
3197 return true; 3204 return true;
3198 } 3205 }
3199 3206
3200 } // namespace webrtc 3207 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/pc/webrtcsdp_unittest.cc » ('j') | webrtc/pc/webrtcsdp_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698