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