diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 19c8a99ff5..42be6450af 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -465,6 +465,8 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame) { switch (avctx->codec_type) { case AVMEDIA_TYPE_VIDEO: + if (av_image_check_size(avctx->width, avctx->height, 0, avctx)) + return AVERROR_INVALIDDATA; frame->width = avctx->width; frame->height = avctx->height; frame->format = avctx->pix_fmt;