[FFmpeg-cvslog] opt: reject denominator zero as out of range

Andreas Cadhalpun git at videolan.org
Tue Dec 13 01:02:16 EET 2016


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Mon Dec 12 01:12:15 2016 +0100| [3ab8436ff611aa488226bbcb25c84bb687b2bf46] | committer: Andreas Cadhalpun

opt: reject denominator zero as out of range

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ab8436ff611aa488226bbcb25c84bb687b2bf46
---

 libavutil/opt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index f855ccb..6ae2af6 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);



More information about the ffmpeg-cvslog mailing list