[csw-devel] SF.net SVN: gar:[8148] csw/mgar/pkg/tiff/trunk

hson at users.sourceforge.net hson at users.sourceforge.net
Mon Jan 25 00:26:33 CET 2010


Revision: 8148
          http://gar.svn.sourceforge.net/gar/?rev=8148&view=rev
Author:   hson
Date:     2010-01-24 23:26:33 +0000 (Sun, 24 Jan 2010)

Log Message:
-----------
tiff: Add runtime package

Modified Paths:
--------------
    csw/mgar/pkg/tiff/trunk/Makefile

Added Paths:
-----------
    csw/mgar/pkg/tiff/trunk/files/libtiff-CVE-2009-2347.patch
    csw/mgar/pkg/tiff/trunk/files/libtiff-jpeg-scanline.patch
    csw/mgar/pkg/tiff/trunk/files/libtiff-mantypo.patch
    csw/mgar/pkg/tiff/trunk/files/libtiff-scanlinesize.patch

Modified: csw/mgar/pkg/tiff/trunk/Makefile
===================================================================
--- csw/mgar/pkg/tiff/trunk/Makefile	2010-01-24 18:58:22 UTC (rev 8147)
+++ csw/mgar/pkg/tiff/trunk/Makefile	2010-01-24 23:26:33 UTC (rev 8148)
@@ -10,19 +10,23 @@
 DISTFILES  = $(GARNAME)-$(GARVERSION).tar.gz
 DISTNAME  = $(GARNAME)-$(GARVERSION)
 
-PACKAGES = CSWtiff CSWtiffdevel CSWtiffdoc
+PACKAGES = CSWtiff CSWtiffrt CSWtiffdevel CSWtiffdoc
 CATALOGNAME_CSWtiff = tiff
+CATALOGNAME_CSWtiffrt = tiffrt
 CATALOGNAME_CSWtiffdevel = tiff_devel
 CATALOGNAME_CSWtiffdoc = tiff_doc
 
-SPKG_DESC_CSWtiff += Library for writing single instance application
-SPKG_DESC_CSWtiffdevel += Library for writing single instance application - developer package
-SPKG_DESC_CSWtiffdoc += Library for writing single instance application - documentation
+SPKG_DESC_CSWtiff += lib and tools for Tag Image File Format
+SPKG_DESC_CSWtiffrt += lib and tools for Tag Image File Format - runtime package
+SPKG_DESC_CSWtiffdevel += lib and tools for Tag Image File Format - developer package
+SPKG_DESC_CSWtiffdoc += lib and tools for Tag Image File Format - documentation
 
-REQUIRED_PKGS_CSWtiff += CSWjbigkit CSWjpeg CSWzlib
-REQUIRED_PKGS_CSWtiffdevel += CSWtiff
-REQUIRED_PKGS_CSWtiffdoc += CSWtiff
+REQUIRED_PKGS_CSWtiff += CSWtiffrtCSWjbigkit CSWjpeg CSWzlib
+REQUIRED_PKGS_CSWtiffrt += CSWjbigkit CSWjpeg CSWzlib
+REQUIRED_PKGS_CSWtiffdevel += CSWtiffrt
+REQUIRED_PKGS_CSWtiffdoc += 
 
+PKGFILES_CSWtiffrt = $(PKGFILES_RT)
 PKGFILES_CSWtiffdevel = $(PKGFILES_DEVEL)
 PKGFILES_CSWtiffdoc = $(sharedstatedir)/doc/.*
 
@@ -32,6 +36,12 @@
 
 SPKG_SOURCEURL = http://www.remotesensing.org/libtiff/
 
+# Patches from upstream (found via src.opensolaris.org), not applied for now
+#PATCHFILES += libtiff-mantypo.patch
+#PATCHFILES += libtiff-scanlinesize.patch
+#PATCHFILES += libtiff-jpeg-scanline.patch
+#PATCHFILES += libtiff-CVE-2009-2347.patch
+
 BUILD64 = 1
 
 STRIP_LIBTOOL = 1

Added: csw/mgar/pkg/tiff/trunk/files/libtiff-CVE-2009-2347.patch
===================================================================
--- csw/mgar/pkg/tiff/trunk/files/libtiff-CVE-2009-2347.patch	                        (rev 0)
+++ csw/mgar/pkg/tiff/trunk/files/libtiff-CVE-2009-2347.patch	2010-01-24 23:26:33 UTC (rev 8148)
@@ -0,0 +1,90 @@
+http://bugzilla.maptools.org/show_bug.cgi?id=2079
+
+
+diff -Naur tiff-3.9.2.orig/tools/tiff2rgba.c tiff-3.9.2/tools/tiff2rgba.c
+--- tiff-3.9.2.orig/tools/tiff2rgba.c	2009-08-20 16:23:53.000000000 -0400
++++ tiff-3.9.2/tools/tiff2rgba.c	2009-12-03 12:19:07.000000000 -0500
+@@ -125,6 +125,17 @@
+     return (0);
+ }
+ 
++static tsize_t
++multiply(tsize_t m1, tsize_t m2)
++{
++    tsize_t prod = m1 * m2;
++
++    if (m1 && prod / m1 != m2)
++        prod = 0;		/* overflow */
++
++    return prod;
++}
++
+ static int
+ cvt_by_tile( TIFF *in, TIFF *out )
+ 
+@@ -134,6 +145,7 @@
+     uint32  tile_width, tile_height;
+     uint32  row, col;
+     uint32  *wrk_line;
++    tsize_t raster_size;
+     int	    ok = 1;
+ 
+     TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
+@@ -151,7 +163,14 @@
+     /*
+      * Allocate tile buffer
+      */
+-    raster = (uint32*)_TIFFmalloc(tile_width * tile_height * sizeof (uint32));
++    raster_size = multiply(multiply(tile_width, tile_height), sizeof (uint32));
++    if (!raster_size) {
++	TIFFError(TIFFFileName(in),
++		  "Can't allocate buffer for raster of size %lux%lu",
++		  (unsigned long) tile_width, (unsigned long) tile_height);
++	return (0);
++    }
++    raster = (uint32*)_TIFFmalloc(raster_size);
+     if (raster == 0) {
+         TIFFError(TIFFFileName(in), "No space for raster buffer");
+         return (0);
+@@ -159,7 +178,7 @@
+ 
+     /*
+      * Allocate a scanline buffer for swapping during the vertical
+-     * mirroring pass.
++     * mirroring pass.  (Request can't overflow given prior checks.)
+      */
+     wrk_line = (uint32*)_TIFFmalloc(tile_width * sizeof (uint32));
+     if (!wrk_line) {
+@@ -236,6 +255,7 @@
+     uint32  width, height;		/* image width & height */
+     uint32  row;
+     uint32  *wrk_line;
++    tsize_t raster_size;
+     int	    ok = 1;
+ 
+     TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
+@@ -251,7 +271,14 @@
+     /*
+      * Allocate strip buffer
+      */
+-    raster = (uint32*)_TIFFmalloc(width * rowsperstrip * sizeof (uint32));
++    raster_size = multiply(multiply(width, rowsperstrip), sizeof (uint32));
++    if (!raster_size) {
++	TIFFError(TIFFFileName(in),
++		  "Can't allocate buffer for raster of size %lux%lu",
++		  (unsigned long) width, (unsigned long) rowsperstrip);
++	return (0);
++    }
++    raster = (uint32*)_TIFFmalloc(raster_size);
+     if (raster == 0) {
+         TIFFError(TIFFFileName(in), "No space for raster buffer");
+         return (0);
+@@ -259,7 +286,7 @@
+ 
+     /*
+      * Allocate a scanline buffer for swapping during the vertical
+-     * mirroring pass.
++     * mirroring pass.  (Request can't overflow given prior checks.)
+      */
+     wrk_line = (uint32*)_TIFFmalloc(width * sizeof (uint32));
+     if (!wrk_line) {

Added: csw/mgar/pkg/tiff/trunk/files/libtiff-jpeg-scanline.patch
===================================================================
--- csw/mgar/pkg/tiff/trunk/files/libtiff-jpeg-scanline.patch	                        (rev 0)
+++ csw/mgar/pkg/tiff/trunk/files/libtiff-jpeg-scanline.patch	2010-01-24 23:26:33 UTC (rev 8148)
@@ -0,0 +1,59 @@
+http://bugzilla.maptools.org/show_bug.cgi?id=1936
+
+
+diff -Naur tiff-3.9.2.orig/libtiff/tif_dir.c tiff-3.9.2/libtiff/tif_dir.c
+--- tiff-3.9.2.orig/libtiff/tif_dir.c	2008-12-31 19:10:43.000000000 -0500
++++ tiff-3.9.2/libtiff/tif_dir.c	2010-01-05 19:59:12.000000000 -0500
+@@ -1100,6 +1100,13 @@
+ 	 */
+ 	tif->tif_flags &= ~TIFF_ISTILED;
+ 
++	/*
++	 * Clear other directory-specific fields.
++	 */
++	tif->tif_tilesize = -1;
++	tif->tif_scanlinesize = -1;
++	
++
+ 	return (1);
+ }
+ 
+diff -Naur tiff-3.9.2.orig/libtiff/tif_jpeg.c tiff-3.9.2/libtiff/tif_jpeg.c
+--- tiff-3.9.2.orig/libtiff/tif_jpeg.c	2009-08-30 12:21:46.000000000 -0400
++++ tiff-3.9.2/libtiff/tif_jpeg.c	2010-01-05 19:59:12.000000000 -0500
+@@ -1613,7 +1613,11 @@
+ 	 * 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 @@
+ 			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 */
+ }
+ 

Added: csw/mgar/pkg/tiff/trunk/files/libtiff-mantypo.patch
===================================================================
--- csw/mgar/pkg/tiff/trunk/files/libtiff-mantypo.patch	                        (rev 0)
+++ csw/mgar/pkg/tiff/trunk/files/libtiff-mantypo.patch	2010-01-24 23:26:33 UTC (rev 8148)
@@ -0,0 +1,15 @@
+http://bugzilla.maptools.org/show_bug.cgi?id=2129
+
+
+diff -Naur tiff-3.9.2.orig/man/tiffset.1 tiff-3.9.2/man/tiffset.1
+--- tiff-3.9.2.orig/man/tiffset.1	2006-04-20 08:17:19.000000000 -0400
++++ tiff-3.9.2/man/tiffset.1	2009-12-03 12:11:58.000000000 -0500
+@@ -60,7 +60,7 @@
+ ``Anonymous'':
+ .RS
+ .nf
+-tiffset \-s 305 Anonymous a.tif
++tiffset \-s 315 Anonymous a.tif
+ .fi
+ .RE
+ .PP

Added: csw/mgar/pkg/tiff/trunk/files/libtiff-scanlinesize.patch
===================================================================
--- csw/mgar/pkg/tiff/trunk/files/libtiff-scanlinesize.patch	                        (rev 0)
+++ csw/mgar/pkg/tiff/trunk/files/libtiff-scanlinesize.patch	2010-01-24 23:26:33 UTC (rev 8148)
@@ -0,0 +1,68 @@
+http://bugzilla.maptools.org/show_bug.cgi?id=2140
+
+
+diff -Naur tiff-3.9.2.orig/libtiff/tif_jpeg.c tiff-3.9.2/libtiff/tif_jpeg.c
+--- tiff-3.9.2.orig/libtiff/tif_jpeg.c	2009-08-30 12:21:46.000000000 -0400
++++ tiff-3.9.2/libtiff/tif_jpeg.c	2010-01-05 22:40:40.000000000 -0500
+@@ -988,8 +988,15 @@
+ 	tsize_t nrows;
+ 	(void) s;
+ 
+-	/* data is expected to be read in multiples of a scanline */
+-	if ( (nrows = sp->cinfo.d.image_height) ) {
++    nrows = cc / sp->bytesperline;
++    if (cc % sp->bytesperline)
++		TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline not read");
++
++    if( nrows > (int) sp->cinfo.d.image_height )
++        nrows = sp->cinfo.d.image_height;
++
++    /* data is expected to be read in multiples of a scanline */
++    if (nrows) {
+ 		/* Cb,Cr both have sampling factors 1, so this is correct */
+ 		JDIMENSION clumps_per_line = sp->cinfo.d.comp_info[1].downsampled_width;            
+ 		int samples_per_clump = sp->samplesperclump;
+@@ -1087,8 +1094,7 @@
+ 			 * TODO: resolve this */
+ 			buf += sp->bytesperline;
+ 			cc -= sp->bytesperline;
+-			nrows -= sp->v_sampling;
+-		} while (nrows > 0);
++		} while (--nrows > 0);
+ 
+ #ifdef JPEG_LIB_MK1
+ 		_TIFFfree(tmpbuf);
+diff -Naur tiff-3.9.2.orig/libtiff/tif_strip.c tiff-3.9.2/libtiff/tif_strip.c
+--- tiff-3.9.2.orig/libtiff/tif_strip.c	2006-03-25 13:04:35.000000000 -0500
++++ tiff-3.9.2/libtiff/tif_strip.c	2010-01-05 21:39:20.000000000 -0500
+@@ -238,23 +238,19 @@
+ 				     ycbcrsubsampling + 0,
+ 				     ycbcrsubsampling + 1);
+ 
+-			if (ycbcrsubsampling[0] == 0) {
++			if (ycbcrsubsampling[0]*ycbcrsubsampling[1] == 0) {
+ 				TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
+ 					     "Invalid YCbCr subsampling");
+ 				return 0;
+ 			}
+ 
+-			scanline = TIFFroundup(td->td_imagewidth,
++			/* number of sample clumps per line */
++			scanline = TIFFhowmany(td->td_imagewidth,
+ 					       ycbcrsubsampling[0]);
+-			scanline = TIFFhowmany8(multiply(tif, scanline,
+-							 td->td_bitspersample,
+-							 "TIFFScanlineSize"));
+-			return ((tsize_t)
+-				summarize(tif, scanline,
+-					  multiply(tif, 2,
+-						scanline / ycbcrsubsampling[0],
+-						"TIFFVStripSize"),
+-					  "TIFFVStripSize"));
++			/* number of samples per line */
++			scanline = multiply(tif, scanline,
++					    ycbcrsubsampling[0]*ycbcrsubsampling[1] + 2,
++					    "TIFFScanlineSize");
+ 		} else {
+ 			scanline = multiply(tif, td->td_imagewidth,
+ 					    td->td_samplesperpixel,


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list