[FFmpeg-devel] [PATCH 3/8] Prevent svq3_get_ue_golomb() from returning a negative value.

Michael Niedermayer michaelni at gmx.at
Sat Sep 17 21:57:20 CEST 2011


On Sat, Sep 17, 2011 at 09:12:06PM +0200, Laurent Aimar wrote:
> On Sat, Sep 17, 2011 at 05:49:32PM +0200, Michael Niedermayer wrote:
> > On Sat, Sep 17, 2011 at 04:56:31PM +0200, fenrir at elivagar.org wrote:
> > > From: Laurent Aimar <fenrir at videolan.org>
> > > 
> > > ---
> > >  libavcodec/golomb.h |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
> > > index 83d277f..58707ed 100644
> > > --- a/libavcodec/golomb.h
> > > +++ b/libavcodec/golomb.h
> > > @@ -124,7 +124,7 @@ static inline int svq3_get_ue_golomb(GetBitContext *gb){
> > >          }
> > >  
> > >          CLOSE_READER(re, gb);
> > > -        return ret - 1;
> > > +        return (ret - 1) & INT_MAX;
> > 
> > the individual uses of this function should check if the data is within
> > the supported range.
> > simply forcing it to be positiv is unlikely to be enough for all
> > cases. Also it causes a tiny speedloss where such checks exists
> > already
>  Well, en general users of this function check for upper bound not lower bound
> (which seems logical given the function names).
>  Another way would be to make it return unsigned and check for every usage but
> it's more work and I think more prone to breakage in the future.

theres no way around checking, ill commit checks in a moment

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

There seems to be only one solution to NIH syndrom, ... a shooting squad
-------------- 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/20110917/3e15fc5c/attachment.asc>


More information about the ffmpeg-devel mailing list