[Intel-gfx] [PATCH 05/13] Xv: introduce planar memcpy helper

Daniel Vetter daniel at ffwll.ch
Tue Jun 30 17:28:13 CEST 2009


On Tue, Jun 30, 2009 at 12:25:27PM +0100, Simon Farnsworth wrote:
> Daniel Vetter wrote:
> > +static void i830_memcpy_plane(unsigned char *dst, unsigned char *src,
> > +		int height, int width,
> > +		int dstPitch, int srcPitch, Rotation rotation)
> > +{
> > +    int i, j = 0;
> > +    unsigned char *s;
> > +
> > +    switch (rotation) {
> > +    case RR_Rotate_0:
> > +	if (srcPitch == dstPitch)
> > +	    memcpy (dst, src, srcPitch * height);
> 
> This is wrong, and will sometimes crash. See Barry Scott's patch in the
> message "[Intel-gfx] [PATCH] Fix segv for clipped movie window".
> 
> You need the test to be:
> if (srcPitch == dstPitch && srcPitch == width)
> 
> Otherwise, in the case where I have covered part of the left edge of the
> video, and part of the right edge of the video, but not covered the
> bottom line of the video, you will walk off the end of the buffer, and
> dereference memory you can't read.
You're right. I've just unified the code, assuming that it works. Barry
Scott's patch has not yet arrived in the git repo. I applied his fix
locally to make sure it's not lost.

Thanks, Daniel

-- 
Daniel Vetter
E-Mail: daniel.vetter at ffwll.ch
Tel.: +41 (0)79 365 57 48



More information about the Intel-gfx mailing list