diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-07-15 19:12:55 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-07-15 19:56:23 +0200 |
commit | 339d8fb3532a9c0ddd3d4902b798cd220f616919 (patch) | |
tree | f121abe269afa46949cd77351b2626f8cfe0a3d7 | |
parent | 97f86cd97604b705d6065be8088dce9cb150dc25 (diff) | |
download | ffmpeg-339d8fb3532a9c0ddd3d4902b798cd220f616919.tar.gz |
avcodec/mpegvideo_enc: check intra dc precission
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index e88b4f3ac8..4bb79f66ce 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) { |