aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-12-09 17:39:38 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-09 17:53:46 +0100
commitab70292fd0c35d1c308f6cdbb810746edf644233 (patch)
tree4b49949fa669457ef8087fb9d2a9972858e53189 /libavutil
parent073fcfe35800d0ad400dd1668727e3741e2a6a34 (diff)
downloadffmpeg-ab70292fd0c35d1c308f6cdbb810746edf644233.tar.gz
avutil/mathematics: Fix division by 0
Fixes: CID1341571 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit bc8b1e694cc395fdf5e2917377ef11263c937d85) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/mathematics.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index 4d8467b8c8..78a87d8457 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -90,7 +90,7 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
else {
int64_t ad = a / c;
int64_t a2 = (a % c * b + r) / c;
- if (ad >= INT32_MAX && ad > (INT64_MAX - a2) / b)
+ if (ad >= INT32_MAX && b && ad > (INT64_MAX - a2) / b)
return INT64_MIN;
return ad * b + a2;
}