[FFmpeg-cvslog] avcodec/mpegvideo_enc: check that max_b_frames is not negative

Michael Niedermayer git at videolan.org
Tue Oct 29 16:19:51 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Oct 29 16:12:01 2013 +0100| [ce55e667facbaf0e7aa8d543b114b28d22c2a250] | committer: Michael Niedermayer

avcodec/mpegvideo_enc: check that max_b_frames is not negative

Fixes crash found by saste
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/mpegvideo_enc.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 9b50386..3db975c 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -452,6 +452,11 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n");
         return -1;
     }
+    if (s->max_b_frames < 0) {
+        av_log(avctx, AV_LOG_ERROR,
+               "max b frames must be 0 or postive for mpegvideo based encoders\n");
+        return -1;
+    }
 
     if ((s->codec_id == AV_CODEC_ID_MPEG4 ||
          s->codec_id == AV_CODEC_ID_H263  ||



More information about the ffmpeg-cvslog mailing list