summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12enc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-06 15:03:19 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-10 03:53:54 +0200
commitd5c7e5cb65ee29a8e66e704ac5b7953657a6ff9c (patch)
tree00473dd18fbd332f792b9d5f92682254ab50ad42 /libavcodec/mpeg12enc.c
parent80410674bd29d552c2af6453c5973323038cc947 (diff)
avcodec/mpeg12enc: Move MPEG-1/2 dimension checks to mpeg12enc
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpeg12enc.c')
-rw-r--r--libavcodec/mpeg12enc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 5676caef87..b7d3d1c6b0 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -144,6 +144,14 @@ static av_cold int encode_init(AVCodecContext *avctx)
{
int ret;
MpegEncContext *s = avctx->priv_data;
+ int max_size = avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO ? 16383 : 4095;
+
+ if (avctx->width > max_size || avctx->height > max_size) {
+ av_log(avctx, AV_LOG_ERROR, "%s does not support resolutions above %dx%d\n",
+ CONFIG_SMALL ? avctx->codec->name : avctx->codec->long_name,
+ max_size, max_size);
+ return AVERROR(EINVAL);
+ }
if ((ret = ff_mpv_encode_init(avctx)) < 0)
return ret;