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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_payload_registry.cc

Issue 1220863002: Fail RTP parsing on excessive padding length. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: move paddingLength to + side Created 5 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 bool RTPPayloadRegistry::IsRtxInternal(const RTPHeader& header) const { 231 bool RTPPayloadRegistry::IsRtxInternal(const RTPHeader& header) const {
232 return rtx_ && ssrc_rtx_ == header.ssrc; 232 return rtx_ && ssrc_rtx_ == header.ssrc;
233 } 233 }
234 234
235 bool RTPPayloadRegistry::RestoreOriginalPacket(uint8_t** restored_packet, 235 bool RTPPayloadRegistry::RestoreOriginalPacket(uint8_t** restored_packet,
236 const uint8_t* packet, 236 const uint8_t* packet,
237 size_t* packet_length, 237 size_t* packet_length,
238 uint32_t original_ssrc, 238 uint32_t original_ssrc,
239 const RTPHeader& header) const { 239 const RTPHeader& header) const {
240 if (kRtxHeaderSize + header.headerLength > *packet_length) { 240 if (kRtxHeaderSize + header.headerLength + header.paddingLength >
241 *packet_length) {
241 return false; 242 return false;
242 } 243 }
243 const uint8_t* rtx_header = packet + header.headerLength; 244 const uint8_t* rtx_header = packet + header.headerLength;
244 uint16_t original_sequence_number = (rtx_header[0] << 8) + rtx_header[1]; 245 uint16_t original_sequence_number = (rtx_header[0] << 8) + rtx_header[1];
245 246
246 // Copy the packet into the restored packet, except for the RTX header. 247 // Copy the packet into the restored packet, except for the RTX header.
247 memcpy(*restored_packet, packet, header.headerLength); 248 memcpy(*restored_packet, packet, header.headerLength);
248 memcpy(*restored_packet + header.headerLength, 249 memcpy(*restored_packet + header.headerLength,
249 packet + header.headerLength + kRtxHeaderSize, 250 packet + header.headerLength + kRtxHeaderSize,
250 *packet_length - header.headerLength - kRtxHeaderSize); 251 *packet_length - header.headerLength - kRtxHeaderSize);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy( 461 RTPPayloadStrategy* RTPPayloadStrategy::CreateStrategy(
461 const bool handling_audio) { 462 const bool handling_audio) {
462 if (handling_audio) { 463 if (handling_audio) {
463 return new RTPPayloadAudioStrategy(); 464 return new RTPPayloadAudioStrategy();
464 } else { 465 } else {
465 return new RTPPayloadVideoStrategy(); 466 return new RTPPayloadVideoStrategy();
466 } 467 }
467 } 468 }
468 469
469 } // namespace webrtc 470 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/fec_receiver_unittest.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_receiver_video.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698