[Ffmpeg-devel] imgresample.c possible loop counter error?

Luca Abeni lucabe72
Mon Oct 23 10:16:56 CEST 2006


Hi,

On Mon, 2006-10-23 at 00:49 +0200, Michael Niedermayer wrote:
> Hi
> 
> On Mon, Oct 23, 2006 at 08:27:53AM +1100, Steven Johnson wrote:
> > Hi,
> > 
> > In imgresample.c at around line 686, there is the following code:
> > 
> > 
> >    uint8_t *buf1 = NULL, *buf2 = NULL;
> >    enum PixelFormat current_pix_fmt;
> > 
> >    for (i = 0; i < 3; i++) {
> >        src_pict.data[i] = src[i];
> >        src_pict.linesize[i] = srcStride[i];
> >        dst_pict.data[i] = dst[i];
> > 
> > Shouldn't the loop actually be <= 3, because the array's being 
> > initialised have 4 entries each, not 3?  Otherwise src_pict.data[3] (and 
> > the others) is uninitialised.
> > 
> > Or is this for a reason?
> 
> it should probably be 4 not 3 yes, but its not a big issue as the 4th
> (alpha) plane is probably not used
Sorry, I never noticed that data[] has lenght 4 and not 3...
I'll change the for() loop in a short time (anyway, both img_resample()
and img_convert() only use the 3 first components of data[]).


Thanks to Steven for noticing and to Michael for explaining.


				Luca





More information about the ffmpeg-devel mailing list