summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chromium/third_party/webrtc/modules/video_coding/rtp_frame_reference_finder.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/chromium/third_party/webrtc/modules/video_coding/rtp_frame_reference_finder.cc b/chromium/third_party/webrtc/modules/video_coding/rtp_frame_reference_finder.cc
index 62f8d7d8a1f..936f53f395b 100644
--- a/chromium/third_party/webrtc/modules/video_coding/rtp_frame_reference_finder.cc
+++ b/chromium/third_party/webrtc/modules/video_coding/rtp_frame_reference_finder.cc
@@ -281,6 +281,9 @@ RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameVp8(
codec_header.tl0PicIdx == kNoTl0PicIdx) {
return ManageFramePidOrSeqNum(frame, codec_header.pictureId);
}
+ // Protect against corrupted packets with arbitrary large temporal idx.
+ if (codec_header.temporalIdx >= kMaxTemporalLayers)
+ return kDrop;
frame->id.picture_id = codec_header.pictureId % kPicIdLength;
@@ -431,6 +434,10 @@ RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameVp9(
return ManageFramePidOrSeqNum(frame, codec_header.picture_id);
}
+ // Protect against corrupted packets with arbitrary large temporal idx.
+ if (codec_header.temporal_idx >= kMaxTemporalLayers)
+ return kDrop;
+
frame->id.spatial_layer = codec_header.spatial_idx;
frame->inter_layer_predicted = codec_header.inter_layer_predicted;
frame->id.picture_id = codec_header.picture_id % kPicIdLength;
@@ -686,6 +693,10 @@ RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameH264(
if (tid == kNoTemporalIdx)
return ManageFramePidOrSeqNum(std::move(frame), kNoPictureId);
+ // Protect against corrupted packets with arbitrary large temporal idx.
+ if (tid >= kMaxTemporalLayers)
+ return kDrop;
+
frame->id.picture_id = frame->last_seq_num();
if (frame->frame_type() == VideoFrameType::kVideoFrameKey) {