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

Michael Niedermayer michaelni at gmx.at
Thu Apr 3 12:45:25 CEST 2014


On Thu, Apr 03, 2014 at 12:36:41PM +0200, Michael Niedermayer wrote:
> 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

hmm, i thought i removed that before hitting reply ;)


> 
> 
> >  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



> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- 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/1bc2f045/attachment.asc>


More information about the ffmpeg-devel mailing list