--- libtiff/tif_dir.c	2011-04-04 05:58:54.000000000 -0400
+++ libtiff/tif_dir.c.oden	2011-04-04 05:59:08.000000000 -0400
@@ -370,6 +370,10 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va
 	case TIFFTAG_YCBCRSUBSAMPLING:
 		td->td_ycbcrsubsampling[0] = (uint16) va_arg(ap, int);
 		td->td_ycbcrsubsampling[1] = (uint16) va_arg(ap, int);
+		if (td->td_ycbcrsubsampling[0] > 4)
+			td->td_ycbcrsubsampling[0] = (td->td_compression == 7) ? 1 : 2;
+		if (td->td_ycbcrsubsampling[1] > 4)
+			td->td_ycbcrsubsampling[1] = (td->td_compression == 7) ? 1 : 2;
 		break;
 	case TIFFTAG_TRANSFERFUNCTION:
 		v = (td->td_samplesperpixel - td->td_extrasamples) > 1 ? 3 : 1;
