changeset 28950:15d4b1684953

Don't write outside of the picture buffer in planarCopy in the gray case
author sdrik
date Tue, 17 Mar 2009 19:51:52 +0000
parents 9d17af5a94a9
children 788a99558cf2
files libswscale/swscale.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale.c	Tue Mar 17 18:44:06 2009 +0000
+++ b/libswscale/swscale.c	Tue Mar 17 19:51:52 2009 +0000
@@ -1934,8 +1934,14 @@
 
         if ((isGray(c->srcFormat) || isGray(c->dstFormat)) && plane>0)
         {
-            if (!isGray(c->dstFormat))
-                memset(dst[plane], 128, dstStride[plane]*height);
+            if (!isGray(c->dstFormat)){
+                int i;
+                uint8_t *ptr = dst[plane] + dstStride[plane]*y;
+                for (i=0; i<height; i++){
+                    memset(ptr, 128, length);
+                    ptr += dstStride[plane];
+                }
+            }
         }
         else
         {