[FFmpeg-devel] [PATCH] IFF: Check for invalid width and height in decoder

Michael Niedermayer michaelni
Mon May 10 17:22:58 CEST 2010


On Mon, May 10, 2010 at 04:07:41PM +0200, Sebastian Vater wrote:
> Ronald S. Bultje a ?crit :
> > Hi,
> >
> > On Mon, May 10, 2010 at 9:58 AM, Sebastian Vater
> > <cdgs.basty at googlemail.com> wrote:
> >   
> >> Ronald S. Bultje a ?crit :
> >>     
> >>> On Mon, May 10, 2010 at 9:48 AM, Sebastian Vater
> >>> <cdgs.basty at googlemail.com> wrote:
> >>>       
> >>>> +    if ( (err = avcodec_check_dimensions(avctx, avctx->width, avctx->height)) )
> >>>> +        return err;
> >>>>         
> >>> Now without the ( ( ( spaces. OK otherwise.
> >>>       
> >> I wanted to do this, too. But thought it could be a nice remember that
> >> the = instead of == is really wanted here.
> >>     
> > [..]
> >   
> >> +    if (err = avcodec_check_dimensions(avctx, avctx->width, avctx->height) )
> >> +        return err;
> >>     
> >
> > I think we misunderstand. The extra (..) are required, gcc will warn
> > without them. The extra spaces around the ( and ) are not.
> >   
> 
> Oh ok!
> 
> > What we usually do is this:
> >    if ((err = avcodec_check_dimensions(avctx, avctx->width, avctx->height)))
> >        return err;
> >   
> 
> Now it should be fine...

avcodec_open() should already do avcodec_check_dimensions() if
width and height are set.
so this just checks for the 0 case in practice

anyway, it doesnt hurt to check it like that, so ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100510/057939eb/attachment.pgp>



More information about the ffmpeg-devel mailing list