diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index 0cc4df9a07..a07f956af0 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -1234,6 +1234,11 @@ static av_cold int encode_init(AVCodecContext *avctx) int ret; static int done = 0; + if (avctx->width >= (1<<13) || avctx->height >= (1<<13)) { + av_log(avctx, AV_LOG_ERROR, "dimensions too large for MPEG-4\n"); + return AVERROR(EINVAL); + } + if((ret=ff_MPV_encode_init(avctx)) < 0) return ret;