Fix CVE-2009-2347 again wrt security #307001.
authorSamuli Suominen <ssuominen@gentoo.org>
Fri, 26 Feb 2010 20:31:34 +0000 (20:31 +0000)
committerSamuli Suominen <ssuominen@gentoo.org>
Fri, 26 Feb 2010 20:31:34 +0000 (20:31 +0000)
Package-Manager: portage-2.2_rc63/cvs/Linux x86_64

media-libs/tiff/ChangeLog
media-libs/tiff/Manifest
media-libs/tiff/files/tiff-3.9.2-CVE-2009-2347.patch [new file with mode: 0644]
media-libs/tiff/tiff-3.9.2-r1.ebuild [new file with mode: 0644]

index e99404cb2a91b72c80bced111398e4fa6e9e88df..96213b510a53f7fe34c7a0c89f0151c8a256b4f4 100644 (file)
@@ -1,6 +1,12 @@
 # ChangeLog for media-libs/tiff
 # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-libs/tiff/ChangeLog,v 1.144 2010/01/22 17:19:11 ssuominen Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-libs/tiff/ChangeLog,v 1.145 2010/02/26 20:31:32 ssuominen Exp $
+
+*tiff-3.9.2-r1 (26 Feb 2010)
+
+  26 Feb 2010; Samuli Suominen <ssuominen@gentoo.org> +tiff-3.9.2-r1.ebuild,
+  +files/tiff-3.9.2-CVE-2009-2347.patch:
+  Fix CVE-2009-2347 again wrt security #307001.
 
   22 Jan 2010; Samuli Suominen <ssuominen@gentoo.org> tiff-3.9.2.ebuild:
   Require SLOT="0" of media-libs/jpeg for headers.
index d544a07bb0c5aac81fafe571ce572e5a813931f0..43db3585eef16d8afdd55c81f34e082c604f0751 100644 (file)
@@ -1,5 +1,7 @@
 AUX tiff-3.8.2-CVE-2009-2285.patch 717 RMD160 6fca42b138383626becf1221ec8550935621f60b SHA1 f2daf5306efb6f0908f0046765a10bf30b2642c2 SHA256 bbe28b7dbc6f24619ad851a53d39149100069af6a5d1578b0cd9ade48d7b127b
+AUX tiff-3.9.2-CVE-2009-2347.patch 2571 RMD160 142c305b3a1cd9c0f27b482ced15104e82f43a19 SHA1 04c0bb3f6bcfa27e89f00f97c843b2f9d5220ce8 SHA256 27839133f0ddd51b7c5f53e85b7985f68284ab0da4ba589e629fe085be62074b
 DIST tiff-3.9.2.tar.gz 1419742 RMD160 22716e0bcee93a654a704900f3e19f41600f3d18 SHA1 5c054d31e350e53102221b7760c3700cf70b4327 SHA256 3cd566c19291ea3379115dd0d2ebcdefb6a7cf0511cc33e733ec3a500e10da69
+EBUILD tiff-3.9.2-r1.ebuild 1619 RMD160 cf7931629e104387d80bf041b8d2c551d7bd5db6 SHA1 0dfcf8bc29e52cb917abe79e77c730c1d400965a SHA256 2183a1b9ab90da3ecd53531a129041d295133a22763eda468a6047c9e8ea0a18
 EBUILD tiff-3.9.2.ebuild 1562 RMD160 49ec862f7ac89ab768026fa62ada8741251f9f9a SHA1 a2088f621217300243d49fdf1bff018875bc41e4 SHA256 42054d25a1eebf2e6294c6ade36c704e12e5f588b4942a5640dde0d2290885a9
-MISC ChangeLog 19766 RMD160 0f12d15427d2a24b1cd23d251e9c638d5adfc59d SHA1 0c1b73c748763b32523064799308510e38af92f1 SHA256 3d9dce8368a4bfd12cbe88f18e4ae580126b6741accbf7e47ba394f7719a9d7c
+MISC ChangeLog 19963 RMD160 5196e5958e297b12b6fe639cd6083fa9668e05e2 SHA1 5aac8f0e1f3b0393bd7e0544d0a9f45bfadd02c7 SHA256 71a7ba0f6895a833ad5628ce66729450562069e85b45a74954935de35fa485d6
 MISC metadata.xml 447 RMD160 8df7883ab02a353acd993037450e7bbc984c052d SHA1 8ffef6a88ae70afbdea7f3be25e1e9a28b6698c5 SHA256 ee7391b2521ef9676ead67466ad7249f05f8d3c9bd8d8984bc0ceac8dcb804b3
diff --git a/media-libs/tiff/files/tiff-3.9.2-CVE-2009-2347.patch b/media-libs/tiff/files/tiff-3.9.2-CVE-2009-2347.patch
new file mode 100644 (file)
index 0000000..8d30334
--- /dev/null
@@ -0,0 +1,89 @@
+http://bugs.gentoo.org/show_bug.cgi?id=307001
+http://bugzilla.maptools.org/show_bug.cgi?id=2079
+
+--- tools/tiff2rgba.c
++++ tools/tiff2rgba.c
+@@ -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) {
diff --git a/media-libs/tiff/tiff-3.9.2-r1.ebuild b/media-libs/tiff/tiff-3.9.2-r1.ebuild
new file mode 100644 (file)
index 0000000..bad4e45
--- /dev/null
@@ -0,0 +1,53 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/tiff/tiff-3.9.2-r1.ebuild,v 1.1 2010/02/26 20:31:32 ssuominen Exp $
+
+EAPI=2
+inherit eutils libtool
+
+DESCRIPTION="Library for manipulation of TIFF (Tag Image File Format) images"
+HOMEPAGE="http://www.remotesensing.org/libtiff/"
+SRC_URI="ftp://ftp.remotesensing.org/pub/libtiff/${P}.tar.gz"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="jpeg jbig +cxx zlib"
+
+DEPEND="jpeg? ( >=media-libs/jpeg-6b:0 )
+       jbig? ( media-libs/jbigkit )
+       zlib? ( sys-libs/zlib )"
+
+src_prepare() {
+       epatch "${FILESDIR}"/${PN}-3.8.2-CVE-2009-2285.patch \
+               "${FILESDIR}"/${P}-CVE-2009-2347.patch
+       elibtoolize
+}
+
+src_configure() {
+       use prefix || EPREFIX=
+       econf \
+               --disable-dependency-tracking \
+               $(use_enable cxx) \
+               $(use_enable zlib) \
+               $(use_enable jpeg) \
+               $(use_enable jbig) \
+               --without-x \
+               --with-docdir="${EPREFIX}"/usr/share/doc/${PF}
+}
+
+src_install() {
+       emake DESTDIR="${D}" install || die
+       dodoc ChangeLog README TODO
+}
+
+pkg_postinst() {
+       if use jbig; then
+               echo
+               elog "JBIG support is intended for Hylafax fax compression, so we"
+               elog "really need more feedback in other areas (most testing has"
+               elog "been done with fax).  Be sure to recompile anything linked"
+               elog "against tiff if you rebuild it with jbig support."
+               echo
+       fi
+}