[FFmpeg-devel] [PATCH]Force gif aspect ratio multiplication to 64bit

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Apr 3 09:14:00 CEST 2014


Hi!

Sorry if I misunderstand but I believe the attached patch is simpler than 
using av_mul_q() to avoid an integer overflow calculating gif aspect ratio.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/gif.c b/libavformat/gif.c
index 68320c6..874bbde 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -36,7 +36,7 @@ static int gif_image_write_header(AVFormatContext *s, int width, int height,
     int i, aspect = 0;
 
     if (sar.num > 0 && sar.den > 0) {
-        aspect = sar.num * 64 / sar.den - 15;
+        aspect = sar.num * 64ULL / sar.den - 15;
         if (aspect < 0 || aspect > 255)
             aspect = 0;
     }


More information about the ffmpeg-devel mailing list