From e19ccc89ef90dcc8ecc5e3e539761a6a6eccbcef Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 19 Mar 2012 20:06:06 +0100 Subject: [PATCH] lavfi/aspect: fail with AVERROR(EINVAL) in case of invalid specified aspect Previously it was returning 0 in case the aspect was parsable but invalid. X-ColaCount: +10*PHIl --- libavfilter/vf_aspect.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c index 89eaf5f189..9e3b93b28d 100644 --- a/libavfilter/vf_aspect.c +++ b/libavfilter/vf_aspect.c @@ -34,15 +34,14 @@ typedef struct { static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) { AspectContext *aspect = ctx->priv; - int ret; aspect->ratio = (AVRational) {0, 1}; if (args) { - if ((ret = av_parse_ratio(&aspect->ratio, args, 100, 0, ctx)) < 0 || + if (av_parse_ratio(&aspect->ratio, args, 100, 0, ctx) || aspect->ratio.num < 0 || aspect->ratio.den <= 0) { av_log(ctx, AV_LOG_ERROR, "Invalid string '%s' for aspect ratio.\n", args); - return ret; + return AVERROR(EINVAL); } }