summaryrefslogtreecommitdiff
path: root/libavutil/opt.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-12-12 01:12:15 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-12-13 00:00:31 +0100
commit3ab8436ff611aa488226bbcb25c84bb687b2bf46 (patch)
tree9a5bce3a196c9e5ae4c3bd46c59b08a8780d8701 /libavutil/opt.c
parentb7e4ea0c80f4b3e060625fd97ffdd3b9689bfcd1 (diff)
opt: reject denominator zero as out of range
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r--libavutil/opt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index f855ccb96d..6ae2af65b8 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -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);