# HG changeset patch # User mstorsjo # Date 1279522951 0 # Node ID f2d98fc0702c3080ae2d2de0f9e7c7ffeebc128c # Parent c447fb1259156bb5cc24af2eb083896ca7199895 Do planar copy with a single memcpy only if the stride is equal to the length This avoids writing outside of the designated rectangle. diff -r c447fb125915 -r f2d98fc0702c libswscale/swscale.c --- a/libswscale/swscale.c Mon Jul 19 00:12:08 2010 +0000 +++ b/libswscale/swscale.c Mon Jul 19 07:02:31 2010 +0000 @@ -1663,10 +1663,10 @@ srcPtr+= srcStride[plane]; dstPtr+= dstStride[plane]; } - } else if (dstStride[plane]==srcStride[plane] && srcStride[plane] > 0) { - if (height > 0) + } else if (dstStride[plane]==srcStride[plane] && srcStride[plane] > 0 && + srcStride[plane] == length) { memcpy(dst[plane] + dstStride[plane]*y, src[plane], - (height - 1)*dstStride[plane] + length); + height*dstStride[plane]); } else { if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) length*=2;