[FFmpeg-cvslog] Force gif aspect ratio multiplication to 64bit.

Carl Eugen Hoyos git at videolan.org
Sat Apr 5 03:31:24 CEST 2014


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Sat Apr  5 01:13:47 2014 +0200| [87f29996415ad2c06ab00583d709fa03b5185305] | committer: Carl Eugen Hoyos

Force gif aspect ratio multiplication to 64bit.

Avoids a possible integer overflow.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87f29996415ad2c06ab00583d709fa03b5185305
---

 libavformat/gif.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/gif.c b/libavformat/gif.c
index 68320c6..e817121 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;
     }



More information about the ffmpeg-cvslog mailing list