[MPlayer-cvslog] r30483 - trunk/libmpcodecs/vf_tfields.c

reimar subversion at mplayerhq.hu
Mon Feb 1 20:14:01 CET 2010


Author: reimar
Date: Mon Feb  1 20:14:01 2010
New Revision: 30483

Log:
Fix -vf tfields=1 so it does not read out of bounds or leave parts of the
output frame uninitialized.

Modified:
   trunk/libmpcodecs/vf_tfields.c

Modified: trunk/libmpcodecs/vf_tfields.c
==============================================================================
--- trunk/libmpcodecs/vf_tfields.c	Mon Feb  1 19:20:22 2010	(r30482)
+++ trunk/libmpcodecs/vf_tfields.c	Mon Feb  1 20:14:01 2010	(r30483)
@@ -43,13 +43,16 @@ static void deint(unsigned char *dest, i
 	int x, y;
 	src += ss;
 	dest += ds;
+	h--;
 	if (field) {
+		fast_memcpy(dest - ds, src - ss, w);
 		src += ss;
 		dest += ds;
-		h -= 2;
+		h--;
 	}
-	for (y=h/2; y; y--) {
-		for (x=0; x<w; x++) {
+	for (y=h/2; y > 0; y--) {
+		dest[0] = src[0];
+		for (x=1; x<w-1; x++) {
 			if (((src[x-ss] < src[x]) && (src[x+ss] < src[x])) ||
 				((src[x-ss] > src[x]) && (src[x+ss] > src[x]))) {
 				//dest[x] = (src[x+ss] + src[x-ss])>>1;
@@ -59,9 +62,12 @@ static void deint(unsigned char *dest, i
 			}
 			else dest[x] = src[x];
 		}
+		dest[w-1] = src[w-1];
 		dest += ds<<1;
 		src += ss<<1;
 	}
+	if (h & 1)
+		fast_memcpy(dest, src, w);
 }
 
 #if HAVE_AMD3DNOW


More information about the MPlayer-cvslog mailing list