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

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

Issue 2064403002: Fix buffer overflow parsing malformed rtp packet (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 const int id = (*ptr & 0xf0) >> 4; 316 const int id = (*ptr & 0xf0) >> 4;
317 const int len = (*ptr & 0x0f); 317 const int len = (*ptr & 0x0f);
318 ptr++; 318 ptr++;
319 319
320 if (id == 15) { 320 if (id == 15) {
321 LOG(LS_WARNING) 321 LOG(LS_WARNING)
322 << "RTP extension header 15 encountered. Terminate parsing."; 322 << "RTP extension header 15 encountered. Terminate parsing.";
323 return; 323 return;
324 } 324 }
325 325
326 if (ptrRTPDataExtensionEnd - ptr < (len+1)) {
åsapersson 2016/06/16 12:22:29 check format here and below (len + 1)
danilchap 2016/06/16 12:54:22 Done.
327 LOG(LS_WARNING) << "Incorrect one-byte extension len: " << (len+1)
328 << ", bytes left in buffer: "
329 << (ptrRTPDataExtensionEnd - ptr);
åsapersson 2016/06/16 12:22:29 maybe also log the id
danilchap 2016/06/16 12:54:22 For this kind of error id is not really interestin
330 return;
331 }
332
326 RTPExtensionType type; 333 RTPExtensionType type;
327 if (ptrExtensionMap->GetType(id, &type) != 0) { 334 if (ptrExtensionMap->GetType(id, &type) != 0) {
328 // If we encounter an unknown extension, just skip over it. 335 // If we encounter an unknown extension, just skip over it.
329 LOG(LS_WARNING) << "Failed to find extension id: " << id; 336 LOG(LS_WARNING) << "Failed to find extension id: " << id;
330 } else { 337 } else {
331 switch (type) { 338 switch (type) {
332 case kRtpExtensionTransmissionTimeOffset: { 339 case kRtpExtensionTransmissionTimeOffset: {
333 if (len != 2) { 340 if (len != 2) {
334 LOG(LS_WARNING) << "Incorrect transmission time offset len: " 341 LOG(LS_WARNING) << "Incorrect transmission time offset len: "
335 << len; 342 << len;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 if (*ptr != 0) { 457 if (*ptr != 0) {
451 return num_zero_bytes; 458 return num_zero_bytes;
452 } 459 }
453 ptr++; 460 ptr++;
454 num_zero_bytes++; 461 num_zero_bytes++;
455 } 462 }
456 return num_zero_bytes; 463 return num_zero_bytes;
457 } 464 }
458 } // namespace RtpUtility 465 } // namespace RtpUtility
459 } // namespace webrtc 466 } // 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