summaryrefslogtreecommitdiff
path: root/libavcodec/h264_ps.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-28 10:54:35 +0100
committerAnton Khirnov <anton@khirnov.net>2014-01-18 20:53:06 +0100
commit9ecabd7892ff073ae60ded3fc0a1290f5914ed5c (patch)
treebc58d8a1beb55b3f3d0a93ba46a9964195c6cc71 /libavcodec/h264_ps.c
parent0652e024c680420d298cdf3719d0a0c030173fe3 (diff)
h264: reset num_reorder_frames if it is invalid
An invalid VUI is not considered a fatal error, so the SPS containing it may still be used. Leaving an invalid value of num_reorder_frames there can result in writing over the bounds of H264Context.delayed_pic. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org
Diffstat (limited to 'libavcodec/h264_ps.c')
-rw-r--r--libavcodec/h264_ps.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 9eb252dffa..033bb79309 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -224,7 +224,9 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps)
if (sps->num_reorder_frames > 16U
/* max_dec_frame_buffering || max_dec_frame_buffering > 16 */) {
av_log(h->avctx, AV_LOG_ERROR,
- "illegal num_reorder_frames %d\n", sps->num_reorder_frames);
+ "Clipping illegal num_reorder_frames %d\n",
+ sps->num_reorder_frames);
+ sps->num_reorder_frames = 16;
return AVERROR_INVALIDDATA;
}
}