8ca2e9
Patch for bug #603081: failure to guard against bogus SamplesPerPixel
8ca2e9
when converting a YCbCr image to RGB.
8ca2e9
8ca2e9
This patch duplicates into PickContigCase() a safety check that already
8ca2e9
existed in PickSeparateCase().
8ca2e9
8ca2e9
Filed upstream at http://bugzilla.maptools.org/show_bug.cgi?id=2216
8ca2e9
8ca2e9
8ca2e9
diff -Naur tiff-3.9.2.orig/libtiff/tif_getimage.c tiff-3.9.2/libtiff/tif_getimage.c
8ca2e9
--- tiff-3.9.2.orig/libtiff/tif_getimage.c	2009-08-30 12:21:46.000000000 -0400
8ca2e9
+++ tiff-3.9.2/libtiff/tif_getimage.c	2010-06-11 12:06:47.000000000 -0400
8ca2e9
@@ -2397,7 +2397,7 @@
8ca2e9
 			}
8ca2e9
 			break;
8ca2e9
 		case PHOTOMETRIC_YCBCR:
8ca2e9
-			if (img->bitspersample == 8)
8ca2e9
+			if ((img->bitspersample==8) && (img->samplesperpixel==3))
8ca2e9
 			{
8ca2e9
 				if (initYCbCrConversion(img)!=0)
8ca2e9
 				{