[FFmpeg-devel] [RFC] consistify/simplify/whatever index validation in vorbis_dec
Reimar Döffinger
Reimar.Doeffinger
Tue Oct 27 15:49:40 CET 2009
On Mon, Oct 05, 2009 at 09:18:13PM +0200, Michael Niedermayer wrote:
> > ===================================================================
> > --- libavcodec/vorbis_dec.c (revision 20001)
> > +++ libavcodec/vorbis_dec.c (working copy)
> > @@ -163,6 +163,15 @@
> > #define BARK(x) \
> > (13.1f*atan(0.00074f*(x))+2.24f*atan(1.85e-8f*(x)*(x))+1e-4f*(x))
> >
> > +
> > +#define VALIDATE_INDEX(idx, limit) \
> > + if (idx >= limit) {\
> > + av_log(vc->avccontext, AV_LOG_ERROR,\
> > + "Index value %d out of range (0 - %d) for %s at %s:%i\n",\
> > + (int)(idx), (int)(limit - 1), #idx, __FILE__, __LINE__);\
> > + return -1;\
> > + }
>
> get_bits() can be included in the macro
In most cases. Somewhat improved version attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vorbisvalidate.diff
Type: text/x-diff
Size: 7939 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091027/06d53032/attachment.diff>
More information about the ffmpeg-devel
mailing list