diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index a2fe7e3..a8c0f28 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -85,6 +85,11 @@ static void build_basic_mjpeg_vlc(MJpegDecodeContext *s) av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) { MJpegDecodeContext *s = avctx->priv_data; + + if (avctx->width > 65500 || avctx->height > 65500) { + av_log(avctx, AV_LOG_ERROR, "JPEG does not support resolutions above 65500x65500\n"); + return -1; + } if (!s->picture_ptr) s->picture_ptr = &s->picture;