Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > main-updates-src > by-pkgid > 94b6fa94bd82bc98b0174a6bd6bb52a4 > files > 8

libtiff-3.9.2-2.7mdv2010.2.src.rpm

Upstream patch for tiff2ps core dump noted in bug #460322.  (Note that
the tiffcmp crash mentioned there is really a different bug.)
Now also incorporating Adam Goode's patch for bug #552360.  See
http://bugzilla.maptools.org/show_bug.cgi?id=1936


diff -Naurp tiff-3.9.1/libtiff/tif_dir.c tiff-3.9.1.oden/libtiff/tif_dir.c
--- tiff-3.9.1/libtiff/tif_dir.c	2008-12-31 19:10:43.000000000 -0500
+++ tiff-3.9.1.oden/libtiff/tif_dir.c	2010-08-05 09:44:56.000000000 -0400
@@ -1099,6 +1099,11 @@ TIFFDefaultDirectory(TIFF* tif)
 	 * Should we also be clearing stuff like INSUBIFD?
 	 */
 	tif->tif_flags &= ~TIFF_ISTILED;
+        /*
+         * Clear other directory-specific fields.
+         */
+        tif->tif_tilesize = -1;
+        tif->tif_scanlinesize = -1;
 
 	return (1);
 }
diff -Naurp tiff-3.9.1/libtiff/tif_jpeg.c tiff-3.9.1.oden/libtiff/tif_jpeg.c
--- tiff-3.9.1/libtiff/tif_jpeg.c	2010-08-05 09:39:27.000000000 -0400
+++ tiff-3.9.1.oden/libtiff/tif_jpeg.c	2010-08-05 09:45:03.000000000 -0400
@@ -1613,7 +1613,11 @@ JPEGResetUpsampled( TIFF* tif )
 	 * Must recalculate cached tile size in case sampling state changed.
 	 * Should we really be doing this now if image size isn't set? 
 	 */
-	tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;
+        if( tif->tif_tilesize > 0 )
+            tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1;
+
+        if(tif->tif_scanlinesize > 0 )
+            tif->tif_scanlinesize = TIFFScanlineSize(tif); 
 }
 
 static int
@@ -1741,13 +1745,21 @@ JPEGFixupTestSubsampling( TIFF * tif )
 			return;
     }
     else
-	{
+    {
         if( !TIFFFillStrip( tif, 0 ) )
             return;
     }
 
     TIFFSetField( tif, TIFFTAG_YCBCRSUBSAMPLING, 
                   (uint16) sp->h_sampling, (uint16) sp->v_sampling );
+
+    /*
+    ** We want to clear the loaded strip so the application has time
+    ** to set JPEGCOLORMODE or other behavior modifiers.  This essentially
+    ** undoes the JPEGPreDecode triggers by TIFFFileStrip().  (#1936)
+    */
+    tif->tif_curstrip = -1;
+
 #endif /* CHECK_JPEG_YCBCR_SUBSAMPLING */
 }