summaryrefslogtreecommitdiff
path: root/libavformat/gif.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2014-04-05 01:13:47 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2014-04-05 01:13:47 +0200
commit87f29996415ad2c06ab00583d709fa03b5185305 (patch)
tree3f5656a7cdaadeb7558d9c107e41407eaec4c1ac /libavformat/gif.c
parentb6850e132f36f5e467b949c36666787b4c2f1331 (diff)
Force gif aspect ratio multiplication to 64bit.
Avoids a possible integer overflow.
Diffstat (limited to 'libavformat/gif.c')
-rw-r--r--libavformat/gif.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/gif.c b/libavformat/gif.c
index 68320c6f23..e817121440 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -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;
}