Commit 3ab8436f authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

opt: reject denominator zero as out of range

Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent b7e4ea0c
......@@ -97,7 +97,7 @@ static int read_number(const AVOption *o, const void *dst, double *num, int *den
static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum)
{
if (o->type != AV_OPT_TYPE_FLAGS &&
(o->max * den < num * intnum || o->min * den > num * intnum)) {
(!den || o->max * den < num * intnum || o->min * den > num * intnum)) {
num = den ? num * intnum / den : (num * intnum ? INFINITY : NAN);
av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range [%g - %g]\n",
num, o->name, o->min, o->max);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment