From e7cd53bf662a93330810981f1d057bdf2ead669e Mon Sep 17 00:00:00 2001 From: Piotr Bandurski Date: Thu, 31 May 2012 20:10:04 +0200 Subject: [PATCH] sgi: check maximum supported resolution Signed-off-by: Vittorio Giovara --- libavcodec/sgienc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/sgienc.c b/libavcodec/sgienc.c index ab1e36ff78..003f6be484 100644 --- a/libavcodec/sgienc.c +++ b/libavcodec/sgienc.c @@ -30,6 +30,12 @@ static av_cold int encode_init(AVCodecContext *avctx) { + if (avctx->width > 65535 || avctx->height > 65535) { + av_log(avctx, AV_LOG_ERROR, + "Unsupported resolution %dx%d.\n", avctx->width, avctx->height); + return AVERROR_INVALIDDATA; + } + avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM);