diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-07 15:47:21 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-18 05:14:30 +0100 |
commit | cc8ab9865650e7542f0340cd27762dbd8da52910 (patch) | |
tree | 416a848d4826d0efc0f2edb8e4e1b6f97a4a7fba | |
parent | d7cff9f8e8f19f8505b189071de66884689558e0 (diff) | |
download | ffmpeg-cc8ab9865650e7542f0340cd27762dbd8da52910.tar.gz |
mpeg12enc: check dimension validity
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/mpeg12enc.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index e8947460ad..cda1464c86 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -180,6 +180,19 @@ static av_cold int encode_init(AVCodecContext *avctx) } } + if ((avctx->width & 0xFFF) == 0 && (avctx->height & 0xFFF) == 1) { + av_log(avctx, AV_LOG_ERROR, "Width / Height is invalid for MPEG2\n"); + return AVERROR(EINVAL); + } + + if (s->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) { + if ((avctx->width & 0xFFF) == 0 || (avctx->height & 0xFFF) == 0) { + av_log(avctx, AV_LOG_ERROR, "Width or Height are not allowed to be multiplies of 4096\n" + "add '-strict %d' if you want to use them anyway.\n", FF_COMPLIANCE_UNOFFICIAL); + return AVERROR(EINVAL); + } + } + s->drop_frame_timecode = s->drop_frame_timecode || !!(avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE); if (s->drop_frame_timecode) s->tc.flags |= AV_TIMECODE_FLAG_DROPFRAME; |