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

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

Issue 2080313002: Merge into M52 Fix buffer overflow parsing malformed rtp packet (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@52
Patch Set: Created 4 years, 6 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 | 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 (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 const int id = (*ptr & 0xf0) >> 4; 312 const int id = (*ptr & 0xf0) >> 4;
313 const int len = (*ptr & 0x0f); 313 const int len = (*ptr & 0x0f);
314 ptr++; 314 ptr++;
315 315
316 if (id == 15) { 316 if (id == 15) {
317 LOG(LS_WARNING) 317 LOG(LS_WARNING)
318 << "RTP extension header 15 encountered. Terminate parsing."; 318 << "RTP extension header 15 encountered. Terminate parsing.";
319 return; 319 return;
320 } 320 }
321 321
322 if (ptrRTPDataExtensionEnd - ptr < (len + 1)) {
323 LOG(LS_WARNING) << "Incorrect one-byte extension len: " << (len + 1)
324 << ", bytes left in buffer: "
325 << (ptrRTPDataExtensionEnd - ptr);
326 return;
327 }
328
322 RTPExtensionType type; 329 RTPExtensionType type;
323 if (ptrExtensionMap->GetType(id, &type) != 0) { 330 if (ptrExtensionMap->GetType(id, &type) != 0) {
324 // If we encounter an unknown extension, just skip over it. 331 // If we encounter an unknown extension, just skip over it.
325 LOG(LS_WARNING) << "Failed to find extension id: " << id; 332 LOG(LS_WARNING) << "Failed to find extension id: " << id;
326 } else { 333 } else {
327 switch (type) { 334 switch (type) {
328 case kRtpExtensionTransmissionTimeOffset: { 335 case kRtpExtensionTransmissionTimeOffset: {
329 if (len != 2) { 336 if (len != 2) {
330 LOG(LS_WARNING) << "Incorrect transmission time offset len: " 337 LOG(LS_WARNING) << "Incorrect transmission time offset len: "
331 << len; 338 << len;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 if (*ptr != 0) { 434 if (*ptr != 0) {
428 return num_zero_bytes; 435 return num_zero_bytes;
429 } 436 }
430 ptr++; 437 ptr++;
431 num_zero_bytes++; 438 num_zero_bytes++;
432 } 439 }
433 return num_zero_bytes; 440 return num_zero_bytes;
434 } 441 }
435 } // namespace RtpUtility 442 } // namespace RtpUtility
436 } // namespace webrtc 443 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698