From 7c7441b37de1b2753062251464072cc766fa7904 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 8 Jul 2014 17:33:39 +0200 Subject: [PATCH] avcodec/roqvideoenc: check dimensions against maximum Signed-off-by: Michael Niedermayer --- libavcodec/roqvideoenc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c index 6530ec7d38..a950a4e865 100644 --- a/libavcodec/roqvideoenc.c +++ b/libavcodec/roqvideoenc.c @@ -972,6 +972,11 @@ static av_cold int roq_encode_init(AVCodecContext *avctx) return AVERROR(EINVAL); } + if (avctx->width > 65535 || avctx->height > 65535) { + av_log(avctx, AV_LOG_ERROR, "Dimensions are max 32768\n"); + return AVERROR(EINVAL); + } + if (((avctx->width)&(avctx->width-1))||((avctx->height)&(avctx->height-1))) av_log(avctx, AV_LOG_ERROR, "Warning: dimensions not power of two\n");