]> git.sesse.net Git - ffmpeg/commitdiff
h264: tighten the valid range for ref_frame_count
authorAnton Khirnov <anton@khirnov.net>
Wed, 18 May 2016 08:04:44 +0000 (10:04 +0200)
committerAnton Khirnov <anton@khirnov.net>
Tue, 21 Jun 2016 09:14:07 +0000 (11:14 +0200)
This field (which the spec calls max_num_ref_frames) must be less than
or equal to MaxDpbFrames, which is at most 16.

libavcodec/h264_ps.c

index 46457a89d5f348bf12f3f8d8a6ea6539b25fdd20..4a56c738bff03574f6ce492a6a40aced1dd0931a 100644 (file)
@@ -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;