[FFmpeg-cvslog] h264: tighten the valid range for ref_frame_count

Anton Khirnov git at videolan.org
Mon Aug 1 20:09:24 EEST 2016


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed May 18 10:04:44 2016 +0200| [70b1dcef2d859ae6b3e21d61de928c3dd0cf1aa4] | committer: Anton Khirnov

h264: tighten the valid range for ref_frame_count

This field (which the spec calls max_num_ref_frames) must be less than
or equal to MaxDpbFrames, which is at most 16.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=70b1dcef2d859ae6b3e21d61de928c3dd0cf1aa4
---

 libavcodec/h264_ps.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 46457a8..4a56c73 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -431,8 +431,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx,
     }
 
     sps->ref_frame_count = get_ue_golomb_31(gb);
-    if (sps->ref_frame_count > H264_MAX_PICTURE_COUNT - 2 ||
-        sps->ref_frame_count >= 32U) {
+    if (sps->ref_frame_count > MAX_DELAYED_PIC_COUNT) {
         av_log(avctx, AV_LOG_ERROR,
                "too many reference frames %d\n", sps->ref_frame_count);
         goto fail;



More information about the ffmpeg-cvslog mailing list