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

mstorsjo subversion
Mon Jul 19 09:02:31 CEST 2010


Author: mstorsjo
Date: Mon Jul 19 09:02:31 2010
New Revision: 31756

Log:
Do planar copy with a single memcpy only if the stride is equal to the length

This avoids writing outside of the designated rectangle.

Modified:
   trunk/libswscale/swscale.c

Modified: trunk/libswscale/swscale.c
==============================================================================
--- trunk/libswscale/swscale.c	Mon Jul 19 02:12:08 2010	(r31755)
+++ trunk/libswscale/swscale.c	Mon Jul 19 09:02:31 2010	(r31756)
@@ -1663,10 +1663,10 @@ static int planarCopyWrapper(SwsContext 
                     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;



More information about the ffmpeg-cvslog mailing list