[Ffmpeg-cvslog] r5530 - in trunk/libavcodec: vc1.c vc1acdata.h vc1data.h

Rich Felker dalias
Wed Jun 28 03:35:15 CEST 2006


On Tue, Jun 27, 2006 at 03:39:02PM +0200, Michael Niedermayer wrote:
> > +static int alloc_bitplane(BitPlane *bp, int width, int height)
> >  {
> > +    if (!bp || bp->width<0 || bp->height<0) return -1;
> > +    bp->data = (uint8_t*)av_malloc(width*height);
> 
> the cast is unneeded, IIRC rich once flamed someone due to such casts :)

Yes it makes the code less readable and serves no purpose. Pointer
casts are almost always either redundant (like here) or potentially
hiding bugs by hiding serious warnings. If a pointer cast ever is
necessary the correct destination type is almost always void *.

> also please be carefull with malloc(x*y) code if the result of the 
> multiplication doesnt fit in an int then this can under some curcumstances
> be exploitable

Yes, please don't introduce more such vulns. We spent forever cleaning
them up in MPlayer...

Rich





More information about the ffmpeg-cvslog mailing list