# HG changeset patch # User mstorsjo # Date 1279302350 0 # Node ID eea755ce8eabcb5493e8f5c3fded4e0779df2f56 # Parent 551ab9b60d4899499365b45f736dac906a1fe531 In planarCopyWrapper, Only copy length, not stride of the last line in the plane If the destination planes are offset within the destination buffer, writing the extra bytes at the end may write outside of the destination buffer. diff -r 551ab9b60d48 -r eea755ce8eab libswscale/swscale.c --- a/libswscale/swscale.c Fri Jul 16 11:21:54 2010 +0000 +++ b/libswscale/swscale.c Fri Jul 16 17:45:50 2010 +0000 @@ -1663,9 +1663,11 @@ srcPtr+= srcStride[plane]; dstPtr+= dstStride[plane]; } - } else if (dstStride[plane]==srcStride[plane] && srcStride[plane] > 0) - memcpy(dst[plane] + dstStride[plane]*y, src[plane], height*dstStride[plane]); - else { + } else if (dstStride[plane]==srcStride[plane] && srcStride[plane] > 0) { + if (height > 0) + memcpy(dst[plane] + dstStride[plane]*y, src[plane], + (height - 1)*dstStride[plane] + length); + } else { if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) length*=2; for (i=0; i