[FFmpeg-cvslog] r31746 - trunk/libswscale/swscale.c

mstorsjo subversion
Fri Jul 16 19:45:50 CEST 2010


Author: mstorsjo
Date: Fri Jul 16 19:45:50 2010
New Revision: 31746

Log:
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.

Modified:
   trunk/libswscale/swscale.c

Modified: trunk/libswscale/swscale.c
==============================================================================
--- trunk/libswscale/swscale.c	Fri Jul 16 13:21:54 2010	(r31745)
+++ trunk/libswscale/swscale.c	Fri Jul 16 19:45:50 2010	(r31746)
@@ -1663,9 +1663,11 @@ static int planarCopyWrapper(SwsContext 
                     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<height; i++) {



More information about the ffmpeg-cvslog mailing list