Commit 87f29996 authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

Force gif aspect ratio multiplication to 64bit.

Avoids a possible integer overflow.
parent b6850e13
......@@ -33,10 +33,11 @@ static int gif_image_write_header(AVFormatContext *s, int width, int height,
{
AVIOContext *pb = s->pb;
AVRational sar = s->streams[0]->codec->sample_aspect_ratio;
int i, aspect = 0;
int i;
int64_t aspect = 0;
if (sar.num > 0 && sar.den > 0) {
aspect = sar.num * 64 / sar.den - 15;
aspect = sar.num * 64LL / sar.den - 15;
if (aspect < 0 || aspect > 255)
aspect = 0;
}
......
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