changeset 15249:0deaa53ed5ad

check for negative strides before memcpy
author henry
date Sun, 24 Apr 2005 07:50:18 +0000
parents 43e55b3d1af0
children e891ff7a7b6c
files postproc/swscale.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/postproc/swscale.c	Sun Apr 24 07:47:41 2005 +0000
+++ b/postproc/swscale.c	Sun Apr 24 07:50:18 2005 +0000
@@ -1425,7 +1425,7 @@
              int srcSliceH, uint8_t* dstParam[], int dstStride[]){
 	uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
 	/* Copy Y plane */
-	if(dstStride[0]==srcStride[0])
+	if(dstStride[0]==srcStride[0] && srcStride[0] > 0)
 		memcpy(dst, src[0], srcSliceH*dstStride[0]);
 	else
 	{
@@ -1559,7 +1559,7 @@
 	int i;
 
 	/* copy Y */
-	if(srcStride[0]==dstStride[0]) 
+	if(srcStride[0]==dstStride[0] && srcStride[0] > 0) 
 		memcpy(dst[0]+ srcSliceY*dstStride[0], src[0], srcStride[0]*srcSliceH);
 	else{
 		uint8_t *srcPtr= src[0];
@@ -1633,7 +1633,7 @@
 
 	if(isPacked(c->srcFormat))
 	{
-		if(dstStride[0]==srcStride[0])
+		if(dstStride[0]==srcStride[0] && srcStride[0] > 0)
 			memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], srcSliceH*dstStride[0]);
 		else
 		{
@@ -1671,7 +1671,7 @@
 			}
 			else
 			{
-				if(dstStride[plane]==srcStride[plane])
+				if(dstStride[plane]==srcStride[plane] && srcStride[plane] > 0)
 					memcpy(dst[plane] + dstStride[plane]*y, src[plane], height*dstStride[plane]);
 				else
 				{