[FFmpeg-devel] [PATCH] lavu/eval: handle div by zero in mod().
Clément Bœsch
ubitux at gmail.com
Wed Jan 2 22:54:13 CET 2013
Similarly to 03f5043f5, we use the FTRAPV config setting.
---
libavutil/eval.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavutil/eval.c b/libavutil/eval.c
index b41c95c..6687b64 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -253,7 +253,7 @@ static double eval_expr(Parser *p, AVExpr *e)
double d = eval_expr(p, e->param[0]);
double d2 = eval_expr(p, e->param[1]);
switch (e->type) {
- case e_mod: return e->value * (d - floor(d/d2)*d2);
+ case e_mod: return e->value * (d - floor((!CONFIG_FTRAPV || d2) ? d / d2 : d * INFINITY) * d2);
case e_gcd: return e->value * av_gcd(d,d2);
case e_max: return e->value * (d > d2 ? d : d2);
case e_min: return e->value * (d < d2 ? d : d2);
--
1.8.0.3
More information about the ffmpeg-devel
mailing list