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 <michaelni@gmx.at>
This commit is contained in:
ami_stuff 2011-05-25 19:53:38 +02:00 committed by Michael Niedermayer
parent b49728df73
commit 7a54edaa16

View File

@ -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", av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n",
avctx->codec->max_lowres); avctx->codec->max_lowres);
ret = AVERROR(EINVAL); ret = AVERROR(EINVAL);