diff --git a/libavcodec/gif.c b/libavcodec/gif.c index ec4be27..01cde72 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -144,6 +144,11 @@ static int gif_image_write_image(AVCodecContext *avctx, static av_cold int gif_encode_init(AVCodecContext *avctx) { GIFContext *s = avctx->priv_data; + + if (avctx->width > 65535 || avctx->height > 65535) { + av_log(avctx, AV_LOG_ERROR, "GIF does not support resolutions above 65535x65535\n"); + return -1; + } avctx->coded_frame = &s->picture; s->lzw = av_mallocz(ff_lzw_encode_state_size);