From 7a54edaa16be3673a2ae8110d1777462c7f6ed7c Mon Sep 17 00:00:00 2001 From: ami_stuff Date: Wed, 25 May 2011 19:53:38 +0200 Subject: Fail when lowres value is lower than 0 The attached patch fixes the crash which happens when user passes lowres value lower than 0 to FFplay. ffplay -lowres -1 test.mpg Signed-off-by: Michael Niedermayer --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavcodec') diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 5354459866..95f41f315a 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -563,7 +563,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) } } - if (avctx->codec->max_lowres < avctx->lowres) { + if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); ret = AVERROR(EINVAL); -- cgit v1.2.3