[FFmpeg-cvslog] avcodec/mpegvideo_enc: check intra dc precission

Michael Niedermayer git at videolan.org
Tue Jul 15 20:14:06 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jul 15 19:12:55 2014 +0200| [339d8fb3532a9c0ddd3d4902b798cd220f616919] | committer: Michael Niedermayer

avcodec/mpegvideo_enc: check intra dc precission

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index e88b4f3..4bb79f6 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -342,6 +342,17 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
     } else if (s->intra_dc_precision >= 8)
         s->intra_dc_precision -= 8;
 
+    if (s->intra_dc_precision < 0) {
+        av_log(avctx, AV_LOG_ERROR,
+                "intra dc precision must be positive, note some applications use"
+                " 0 and some 8 as base meaning 8bit, the value must not be smaller than that\n");
+        return AVERROR(EINVAL);
+    }
+
+    if (s->intra_dc_precision > (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO ? 3 : 0)) {
+        av_log(avctx, AV_LOG_ERROR, "intra dc precision too large\n");
+        return AVERROR(EINVAL);
+    }
     s->user_specified_pts = AV_NOPTS_VALUE;
 
     if (s->gop_size <= 1) {



More information about the ffmpeg-cvslog mailing list