Commit bc8b1e69 authored by Michael Niedermayer's avatar Michael Niedermayer

avutil/mathematics: Fix division by 0

Fixes: CID1341571
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 8cfa912e
......@@ -85,7 +85,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;
}
......
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