From 652d81b2c2201922f0fef2bbd171299ce3798d12 Mon Sep 17 00:00:00 2001 From: Shitiz Garg Date: Thu, 15 Dec 2011 22:20:21 +0000 Subject: [PATCH] cljr: Check if width and height are positive integers Width and height might get passed as 0 and would cause floating point exceptions in decode_frame. Fixes bugzilla #149 Signed-off-by: Janne Grunau --- libavcodec/cljr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/cljr.c b/libavcodec/cljr.c index a5ee73864c..f40d4d17ce 100644 --- a/libavcodec/cljr.c +++ b/libavcodec/cljr.c @@ -57,6 +57,11 @@ static int decode_frame(AVCodecContext *avctx, if (p->data[0]) avctx->release_buffer(avctx, p); + if (avctx->height <= 0 || avctx->width <= 0) { + av_log(avctx, AV_LOG_ERROR, "Invalid width or height\n"); + return AVERROR_INVALIDDATA; + } + if (buf_size / avctx->height < avctx->width) { av_log(avctx, AV_LOG_ERROR, "Resolution larger than buffer size. Invalid header?\n");