d00bc4
Fix misbehavior on 64-bit machines when trying to flip a downsampled image
d00bc4
vertically: unsigned ints will be widened to 64 bits the wrong way.
d00bc4
See RH bug #583081.
d00bc4
d00bc4
Filed upstream at http://bugzilla.maptools.org/show_bug.cgi?id=2207
d00bc4
d00bc4
d00bc4
diff -Naur tiff-3.9.2.orig/libtiff/tif_getimage.c tiff-3.9.2/libtiff/tif_getimage.c
d00bc4
--- tiff-3.9.2.orig/libtiff/tif_getimage.c	2009-08-30 12:21:46.000000000 -0400
d00bc4
+++ tiff-3.9.2/libtiff/tif_getimage.c	2010-06-10 15:07:28.000000000 -0400
d00bc4
@@ -1846,6 +1846,7 @@
d00bc4
 DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
d00bc4
 {
d00bc4
 	uint32* cp2;
d00bc4
+	int32 incr = 2*toskew+w;
d00bc4
 	(void) y;
d00bc4
 	fromskew = (fromskew / 2) * 6;
d00bc4
 	cp2 = cp+w+toskew;
d00bc4
@@ -1872,8 +1873,8 @@
d00bc4
 			cp2 ++ ;
d00bc4
 			pp += 6;
d00bc4
 		}
d00bc4
-		cp += toskew*2+w;
d00bc4
-		cp2 += toskew*2+w;
d00bc4
+		cp += incr;
d00bc4
+		cp2 += incr;
d00bc4
 		pp += fromskew;
d00bc4
 		h-=2;
d00bc4
 	}
d00bc4
@@ -1939,6 +1940,7 @@
d00bc4
 DECLAREContigPutFunc(putcontig8bitYCbCr12tile)
d00bc4
 {
d00bc4
 	uint32* cp2;
d00bc4
+	int32 incr = 2*toskew+w;
d00bc4
 	(void) y;
d00bc4
 	fromskew = (fromskew / 2) * 4;
d00bc4
 	cp2 = cp+w+toskew;
d00bc4
@@ -1953,8 +1955,8 @@
d00bc4
 			cp2 ++;
d00bc4
 			pp += 4;
d00bc4
 		} while (--x);
d00bc4
-		cp += toskew*2+w;
d00bc4
-		cp2 += toskew*2+w;
d00bc4
+		cp += incr;
d00bc4
+		cp2 += incr;
d00bc4
 		pp += fromskew;
d00bc4
 		h-=2;
d00bc4
 	}