[FFmpeg-devel] [PATCH]Force gif aspect ratio multiplication to 64bit
Michael Niedermayer
michaelni at gmx.at
Thu Apr 3 12:36:41 CEST 2014
On Thu, Apr 03, 2014 at 09:14:00AM +0200, Carl Eugen Hoyos wrote:
> 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
LGTM
> gif.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 40524f0f32562662aa8e4446336de11d3e71490c patchgifaspect64.diff
> 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)
thats not sufficient, aspect is just an int and this might not fit
in it also the <0 check needs int64 not uint64
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140403/8e898d9c/attachment.asc>
More information about the ffmpeg-devel
mailing list