Major update to 4.0.1, which adds BigTIFF support and includes some API

changes.  Also include upstream fix for CVE-2012-1173.
This commit is contained in:
naddy 2012-04-14 15:09:55 +00:00
parent 982bd4d9e4
commit 5cab5c465d
20 changed files with 134 additions and 218 deletions

View File

@ -1,11 +1,10 @@
# $OpenBSD: Makefile,v 1.63 2012/04/09 17:35:38 naddy Exp $
# $OpenBSD: Makefile,v 1.64 2012/04/14 15:09:55 naddy Exp $
COMMENT= tools and library routines for working with TIFF images
DISTNAME= tiff-3.9.6
REVISION= 0
SHARED_LIBS= tiff 38.3 # 39.6
SHARED_LIBS+= tiffxx 39.3 # 39.6
DISTNAME= tiff-4.0.1
SHARED_LIBS= tiff 39.0 # 5.6
SHARED_LIBS+= tiffxx 40.0 # 5.6
CATEGORIES= graphics
MASTER_SITES= http://download.osgeo.org/libtiff/
@ -13,7 +12,7 @@ MASTER_SITES= http://download.osgeo.org/libtiff/
HOMEPAGE= http://www.remotesensing.org/libtiff/
LIB_DEPENDS= graphics/jpeg
WANTLIB= c m stdc++ z jpeg>=64
WANTLIB= c m stdc++ z jpeg
# BSD
PERMIT_PACKAGE_CDROM= Yes
@ -22,10 +21,10 @@ PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
USE_LIBTOOL= Yes
USE_GROFF = Yes
CONFIGURE_STYLE=gnu
CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
--disable-jbig \
--disable-lzma \
--with-docdir="${PREFIX}/share/doc/tiff" \
--with-jpeg-include-dir="${LOCALBASE}/include" \
--with-jpeg-lib-dir="${LOCALBASE}/lib" \

View File

@ -1,5 +1,5 @@
MD5 (tiff-3.9.6.tar.gz) = aSDzv2KNeR1J8mi4NhLtIw==
RMD160 (tiff-3.9.6.tar.gz) = zj7lXvP9zgwwBX5vav8QfyNHeo8=
SHA1 (tiff-3.9.6.tar.gz) = 8OhtP8OlKyn0yna4Q29bXWYYsYs=
SHA256 (tiff-3.9.6.tar.gz) = D7oRkVYjYHQ0OhSvvTpHkH46WVLJyGECMF1O6wataDM=
SIZE (tiff-3.9.6.tar.gz) = 1454196
MD5 (tiff-4.0.1.tar.gz) = +uFJzJ2jXFmNi+iXgm38Yw==
RMD160 (tiff-4.0.1.tar.gz) = q/mKsnftruMCtDLbzs/mgGHdkdw=
SHA1 (tiff-4.0.1.tar.gz) = i684IjHJBRobPrKUWBKJqiFEcXE=
SHA256 (tiff-4.0.1.tar.gz) = mnoDnlFsN0eAOHQPFkKBglC/sUFM9ATMi1aeX51L8vA=
SIZE (tiff-4.0.1.tar.gz) = 1991580

View File

@ -1,14 +1,12 @@
$OpenBSD: patch-Makefile_in,v 1.6 2012/04/09 17:21:05 naddy Exp $
--- Makefile.in.orig Sat Feb 18 23:27:08 2012
+++ Makefile.in Mon Apr 9 19:13:44 2012
@@ -336,8 +336,8 @@ EXTRA_DIST = \
configure.com \
nmake.opt
$OpenBSD: patch-Makefile_in,v 1.7 2012/04/14 15:09:55 naddy Exp $
--- Makefile.in.orig Wed Apr 11 19:07:52 2012
+++ Makefile.in Wed Apr 11 19:11:49 2012
@@ -339,7 +339,7 @@ EXTRA_DIST = \
libtiff-4.pc.in
-dist_doc_DATA = $(docfiles)
dist_doc_DATA = $(docfiles)
-SUBDIRS = port libtiff tools build contrib test man html
+dist_doc_DATA =
+SUBDIRS = port libtiff tools build test man html
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libtiff-4.pc
all: all-recursive
.SUFFIXES:

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-html_Makefile_in,v 1.6 2012/04/09 17:21:05 naddy Exp $
--- html/Makefile.in.orig Sat Feb 18 23:27:07 2012
+++ html/Makefile.in Mon Apr 9 19:13:44 2012
@@ -268,7 +268,7 @@ build_vendor = @build_vendor@
$OpenBSD: patch-html_Makefile_in,v 1.7 2012/04/14 15:09:55 naddy Exp $
--- html/Makefile.in.orig Sat Feb 18 23:02:56 2012
+++ html/Makefile.in Wed Apr 11 18:20:48 2012
@@ -267,7 +267,7 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@

View File

@ -1,11 +1,11 @@
$OpenBSD: patch-libtiff_Makefile_in,v 1.11 2012/04/09 17:21:05 naddy Exp $
$OpenBSD: patch-libtiff_Makefile_in,v 1.12 2012/04/14 15:09:55 naddy Exp $
* Avoid picking up an old libtiff in ${LOCALBASE}.
* Do not record inter-library dependencies.
--- libtiff/Makefile.in.orig Sat Feb 18 23:27:08 2012
+++ libtiff/Makefile.in Mon Apr 9 19:13:44 2012
@@ -238,10 +238,10 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
--- libtiff/Makefile.in.orig Sat Feb 18 23:02:56 2012
+++ libtiff/Makefile.in Wed Apr 11 19:06:03 2012
@@ -254,10 +254,10 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-libtiff_tif_codec_c,v 1.1 2010/06/30 17:10:08 naddy Exp $
--- libtiff/tif_codec.c.orig Sun Jun 27 01:01:03 2010
+++ libtiff/tif_codec.c Sun Jun 27 01:01:17 2010
@@ -104,7 +104,7 @@ _notConfigured(TIFF* tif)
$OpenBSD: patch-libtiff_tif_codec_c,v 1.2 2012/04/14 15:09:55 naddy Exp $
--- libtiff/tif_codec.c.orig Tue Dec 14 15:18:28 2010
+++ libtiff/tif_codec.c Wed Apr 11 18:22:55 2012
@@ -108,7 +108,7 @@ _notConfigured(TIFF* tif)
const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
char compression_code[20];

View File

@ -1,19 +1,19 @@
$OpenBSD: patch-libtiff_tif_compress_c,v 1.3 2010/06/30 17:10:08 naddy Exp $
--- libtiff/tif_compress.c.orig Sun Jun 27 01:04:02 2010
+++ libtiff/tif_compress.c Sun Jun 27 01:10:03 2010
@@ -193,14 +193,15 @@ TIFFFindCODEC(uint16 scheme)
$OpenBSD: patch-libtiff_tif_compress_c,v 1.4 2012/04/14 15:09:55 naddy Exp $
--- libtiff/tif_compress.c.orig Wed Apr 11 18:23:56 2012
+++ libtiff/tif_compress.c Wed Apr 11 18:25:07 2012
@@ -201,14 +201,15 @@ TIFFFindCODEC(uint16 scheme)
TIFFCodec*
TIFFRegisterCODEC(uint16 scheme, const char* name, TIFFInitMethod init)
{
+ size_t namelen = strlen(name);
codec_t* cd = (codec_t*)
- _TIFFmalloc(sizeof (codec_t) + sizeof (TIFFCodec) + strlen(name)+1);
+ _TIFFmalloc(sizeof (codec_t) + sizeof (TIFFCodec) + namelen+1);
- _TIFFmalloc((tmsize_t)(sizeof (codec_t) + sizeof (TIFFCodec) + strlen(name)+1));
+ _TIFFmalloc((tmsize_t)(sizeof (codec_t) + sizeof (TIFFCodec) + namelen+1));
if (cd != NULL) {
cd->info = (TIFFCodec*) ((tidata_t) cd + sizeof (codec_t));
cd->info = (TIFFCodec*) ((uint8*) cd + sizeof (codec_t));
cd->info->name = (char*)
((tidata_t) cd->info + sizeof (TIFFCodec));
((uint8*) cd->info + sizeof (TIFFCodec));
- strcpy(cd->info->name, name);
+ strlcpy(cd->info->name, name, namelen+1);
cd->info->scheme = scheme;

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-libtiff_tif_dirinfo_c,v 1.5 2011/05/09 08:14:43 giovanni Exp $
--- libtiff/tif_dirinfo.c.orig Thu Jul 8 18:17:59 2010
+++ libtiff/tif_dirinfo.c Thu Apr 21 15:35:54 2011
@@ -869,7 +869,7 @@ _TIFFCreateAnonFieldInfo(TIFF *tif, ttag_t tag, TIFFDa
$OpenBSD: patch-libtiff_tif_dirinfo_c,v 1.6 2012/04/14 15:09:55 naddy Exp $
--- libtiff/tif_dirinfo.c.orig Tue May 31 16:33:06 2011
+++ libtiff/tif_dirinfo.c Wed Apr 11 18:25:33 2012
@@ -661,7 +661,7 @@ _TIFFCreateAnonField(TIFF *tif, uint32 tag, TIFFDataTy
* note that this name is a special sign to TIFFClose() and
* _TIFFSetupFieldInfo() to free the field
* _TIFFSetupFields() to free the field
*/
- sprintf(fld->field_name, "Tag %d", (int) tag);
+ snprintf(fld->field_name, 32, "Tag %d", (int) tag);

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-libtiff_tif_extension_c,v 1.3 2010/06/30 17:10:08 naddy Exp $
--- libtiff/tif_extension.c.orig Sun Jun 27 01:06:26 2010
+++ libtiff/tif_extension.c Sun Jun 27 01:08:54 2010
$OpenBSD: patch-libtiff_tif_extension_c,v 1.4 2012/04/14 15:09:55 naddy Exp $
--- libtiff/tif_extension.c.orig Wed Apr 11 18:27:24 2012
+++ libtiff/tif_extension.c Wed Apr 11 18:28:53 2012
@@ -81,6 +81,7 @@ void TIFFSetClientInfo( TIFF *tif, void *data, const c
{
@ -13,8 +13,8 @@ $OpenBSD: patch-libtiff_tif_extension_c,v 1.3 2010/06/30 17:10:08 naddy Exp $
link = (TIFFClientInfoLink *) _TIFFmalloc(sizeof(TIFFClientInfoLink));
assert (link != NULL);
link->next = tif->tif_clientinfo;
- link->name = (char *) _TIFFmalloc(strlen(name)+1);
+ link->name = (char *) _TIFFmalloc(namelen+1);
- link->name = (char *) _TIFFmalloc((tmsize_t)(strlen(name)+1));
+ link->name = (char *) _TIFFmalloc((tmsize_t)(namelen+1));
assert (link->name != NULL);
- strcpy(link->name, name);
+ strlcpy(link->name, name, namelen+1);

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-libtiff_tif_getimage_c,v 1.6 2012/04/09 17:35:38 naddy Exp $
$OpenBSD: patch-libtiff_tif_getimage_c,v 1.7 2012/04/14 15:09:55 naddy Exp $
1. sprintf()
This one is slightly problematic. If an application allocates less
@ -7,9 +7,9 @@ buffer will still overflow.
2. CVE-2012-1173: integer overflow.
--- libtiff/tif_getimage.c.orig Thu Jul 8 18:17:59 2010
+++ libtiff/tif_getimage.c Mon Apr 9 19:26:57 2012
@@ -76,7 +76,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
--- libtiff/tif_getimage.c.orig Wed Apr 11 18:42:32 2012
+++ libtiff/tif_getimage.c Wed Apr 11 18:53:00 2012
@@ -80,7 +80,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
int colorchannels;
if (!tif->tif_decodestatus) {
@ -18,7 +18,7 @@ buffer will still overflow.
return (0);
}
switch (td->td_bitspersample) {
@@ -87,7 +87,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
@@ -91,7 +91,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
case 16:
break;
default:
@ -27,7 +27,7 @@ buffer will still overflow.
td->td_bitspersample);
return (0);
}
@@ -101,7 +101,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
@@ -105,7 +105,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
photometric = PHOTOMETRIC_RGB;
break;
default:
@ -36,7 +36,7 @@ buffer will still overflow.
return (0);
}
}
@@ -112,7 +112,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
@@ -116,7 +116,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
if (td->td_planarconfig == PLANARCONFIG_CONTIG
&& td->td_samplesperpixel != 1
&& td->td_bitspersample < 8 ) {
@ -45,7 +45,7 @@ buffer will still overflow.
"Sorry, can not handle contiguous data with %s=%d, "
"and %s=%d and Bits/Sample=%d",
photoTag, photometric,
@@ -136,7 +136,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
@@ -140,7 +140,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
break;
case PHOTOMETRIC_RGB:
if (colorchannels < 3) {
@ -54,7 +54,7 @@ buffer will still overflow.
"Color channels", colorchannels);
return (0);
}
@@ -146,13 +146,13 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
@@ -150,13 +150,13 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
uint16 inkset;
TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
if (inkset != INKSET_CMYK) {
@ -70,7 +70,7 @@ buffer will still overflow.
"Sorry, can not handle separated image with %s=%d",
"Samples/pixel", td->td_samplesperpixel);
return 0;
@@ -161,7 +161,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
@@ -165,7 +165,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
}
case PHOTOMETRIC_LOGL:
if (td->td_compression != COMPRESSION_SGILOG) {
@ -79,7 +79,7 @@ buffer will still overflow.
"Compression", COMPRESSION_SGILOG);
return (0);
}
@@ -169,12 +169,12 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
@@ -173,12 +173,12 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
case PHOTOMETRIC_LOGLUV:
if (td->td_compression != COMPRESSION_SGILOG &&
td->td_compression != COMPRESSION_SGILOG24) {
@ -94,7 +94,7 @@ buffer will still overflow.
"Planarconfiguration", td->td_planarconfig);
return (0);
}
@@ -182,7 +182,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
@@ -186,7 +186,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
case PHOTOMETRIC_CIELAB:
break;
default:
@ -103,43 +103,43 @@ buffer will still overflow.
photoTag, photometric);
return (0);
}
@@ -250,7 +250,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
@@ -260,7 +260,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
case 16:
break;
default:
- sprintf(emsg, "Sorry, can not handle images with %d-bit samples",
+ snprintf(emsg, 1024, "Sorry, can not handle images with %d-bit samples",
img->bitspersample);
return (0);
goto fail_return;
}
@@ -300,7 +300,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
@@ -310,7 +310,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
img->photometric = PHOTOMETRIC_RGB;
break;
default:
- sprintf(emsg, "Missing needed %s tag", photoTag);
+ snprintf(emsg, 1024, "Missing needed %s tag", photoTag);
return (0);
goto fail_return;
}
}
@@ -308,7 +308,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
@@ -318,7 +318,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
case PHOTOMETRIC_PALETTE:
if (!TIFFGetField(tif, TIFFTAG_COLORMAP,
&red_orig, &green_orig, &blue_orig)) {
- sprintf(emsg, "Missing required \"Colormap\" tag");
+ snprintf(emsg, 1024, "Missing required \"Colormap\" tag");
return (0);
goto fail_return;
}
@@ -318,7 +318,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
@@ -328,7 +328,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
img->greencmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
img->bluecmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
if( !img->redcmap || !img->greencmap || !img->bluecmap ) {
- sprintf(emsg, "Out of memory for colormap copy");
+ snprintf(emsg, 1024, "Out of memory for colormap copy");
return (0);
goto fail_return;
}
@@ -332,7 +332,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
@@ -342,7 +342,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
if (planarconfig == PLANARCONFIG_CONTIG
&& img->samplesperpixel != 1
&& img->bitspersample < 8 ) {
@ -148,47 +148,47 @@ buffer will still overflow.
"Sorry, can not handle contiguous data with %s=%d, "
"and %s=%d and Bits/Sample=%d",
photoTag, img->photometric,
@@ -369,7 +369,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
@@ -379,7 +379,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
break;
case PHOTOMETRIC_RGB:
if (colorchannels < 3) {
- sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
+ snprintf(emsg, 1024, "Sorry, can not handle RGB image with %s=%d",
"Color channels", colorchannels);
return (0);
goto fail_return;
}
@@ -379,12 +379,12 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
@@ -389,12 +389,12 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
uint16 inkset;
TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
if (inkset != INKSET_CMYK) {
- sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
+ snprintf(emsg, 1024, "Sorry, can not handle separated image with %s=%d",
"InkSet", inkset);
return (0);
goto fail_return;
}
if (img->samplesperpixel < 4) {
- sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
+ snprintf(emsg, 1024, "Sorry, can not handle separated image with %s=%d",
"Samples/pixel", img->samplesperpixel);
return (0);
goto fail_return;
}
@@ -392,7 +392,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
@@ -402,7 +402,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
break;
case PHOTOMETRIC_LOGL:
if (compress != COMPRESSION_SGILOG) {
- sprintf(emsg, "Sorry, LogL data must have %s=%d",
+ snprintf(emsg, 1024, "Sorry, LogL data must have %s=%d",
"Compression", COMPRESSION_SGILOG);
return (0);
goto fail_return;
}
@@ -402,12 +402,12 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
@@ -412,12 +412,12 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
break;
case PHOTOMETRIC_LOGLUV:
if (compress != COMPRESSION_SGILOG && compress != COMPRESSION_SGILOG24) {
- sprintf(emsg, "Sorry, LogLuv data must have %s=%d or %d",
+ snprintf(emsg, 1024, "Sorry, LogLuv data must have %s=%d or %d",
"Compression", COMPRESSION_SGILOG, COMPRESSION_SGILOG24);
return (0);
goto fail_return;
}
if (planarconfig != PLANARCONFIG_CONTIG) {
- sprintf(emsg, "Sorry, can not handle LogLuv images with %s=%d",
@ -196,50 +196,52 @@ buffer will still overflow.
"Planarconfiguration", planarconfig);
return (0);
}
@@ -418,7 +418,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
@@ -428,7 +428,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
case PHOTOMETRIC_CIELAB:
break;
default:
- sprintf(emsg, "Sorry, can not handle image with %s=%d",
+ snprintf(emsg, 1024, "Sorry, can not handle image with %s=%d",
photoTag, img->photometric);
return (0);
goto fail_return;
}
@@ -434,12 +434,12 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
!(planarconfig == PLANARCONFIG_SEPARATE && colorchannels > 1);
@@ -446,12 +446,12 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int
!(planarconfig == PLANARCONFIG_SEPARATE && img->samplesperpixel > 1);
if (img->isContig) {
if (!PickContigCase(img)) {
- sprintf(emsg, "Sorry, can not handle image");
+ snprintf(emsg, 1024, "Sorry, can not handle image");
return 0;
goto fail_return;
}
} else {
if (!PickSeparateCase(img)) {
- sprintf(emsg, "Sorry, can not handle image");
+ snprintf(emsg, 1024, "Sorry, can not handle image");
return 0;
goto fail_return;
}
}
@@ -673,18 +673,24 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uin
@@ -692,6 +692,7 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uin
unsigned char* p2;
unsigned char* pa;
tsize_t tilesize;
+ tsize_t bufsize;
tmsize_t tilesize;
+ tmsize_t bufsize;
int32 fromskew, toskew;
int alpha = img->alpha;
uint32 nrow;
int ret = 1, flip;
@@ -699,12 +700,18 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uin
int colorchannels;
tilesize = TIFFTileSize(tif);
tilesize = TIFFTileSize(tif);
- buf = (unsigned char*) _TIFFmalloc((alpha?4:3)*tilesize);
+ bufsize = TIFFSafeMultiply(tsize_t,alpha?4:3,tilesize);
+
+ bufsize = TIFFSafeMultiply(tmsize_t,alpha?4:3,tilesize);
+ if (bufsize == 0) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Integer overflow in %s", "gtTileSeparate");
+ return (0);
+ }
+ buf = (unsigned char*) _TIFFmalloc(bufsize);
if (buf == 0) {
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "%s", "No space for tile buffer");
return (0);
}
- _TIFFmemset(buf, 0, (alpha?4:3)*tilesize);
@ -247,18 +249,18 @@ buffer will still overflow.
p0 = buf;
p1 = p0 + tilesize;
p2 = p1 + tilesize;
@@ -880,17 +886,23 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, ui
@@ -917,17 +924,23 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, ui
uint32 rowsperstrip, offset_row;
uint32 imagewidth = img->width;
tsize_t stripsize;
+ tsize_t bufsize;
tmsize_t stripsize;
+ tmsize_t bufsize;
int32 fromskew, toskew;
int alpha = img->alpha;
int ret = 1, flip;
int ret = 1, flip, colorchannels;
stripsize = TIFFStripSize(tif);
stripsize = TIFFStripSize(tif);
- p0 = buf = (unsigned char *)_TIFFmalloc((alpha?4:3)*stripsize);
+ bufsize = TIFFSafeMultiply(tsize_t,alpha?4:3,stripsize);
+ bufsize = TIFFSafeMultiply(tmsize_t,alpha?4:3,stripsize);
+ if (bufsize == 0) {
+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Integer overflow in %s", "gtStripSeparate");
+ return (0);

View File

@ -1,18 +1,21 @@
$OpenBSD: patch-libtiff_tif_open_c,v 1.1 2010/06/30 17:10:08 naddy Exp $
--- libtiff/tif_open.c.orig Sun Jun 27 01:10:42 2010
+++ libtiff/tif_open.c Sun Jun 27 01:11:52 2010
@@ -154,18 +154,20 @@ TIFFClientOpen(
$OpenBSD: patch-libtiff_tif_open_c,v 1.2 2012/04/14 15:09:55 naddy Exp $
--- libtiff/tif_open.c.orig Wed Apr 11 18:54:12 2012
+++ libtiff/tif_open.c Wed Apr 11 18:55:56 2012
@@ -86,6 +86,7 @@ TIFFClientOpen(
TIFF *tif;
int m;
const char* cp;
+ size_t namelen;
/* The following are configuration checks. They should be redundant, but should not
* compile to any actual code in an optimised release build anyway. If any of them
@@ -116,14 +117,15 @@ TIFFClientOpen(
m = _TIFFgetMode(mode, module);
if (m == -1)
goto bad2;
- tif = (TIFF *)_TIFFmalloc(sizeof (TIFF) + strlen(name) + 1);
- tif = (TIFF *)_TIFFmalloc((tmsize_t)(sizeof (TIFF) + strlen(name) + 1));
+ namelen = strlen(name);
+ tif = (TIFF *)_TIFFmalloc(sizeof (TIFF) + namelen + 1);
+ tif = (TIFF *)_TIFFmalloc((tmsize_t)(sizeof (TIFF) + namelen + 1));
if (tif == NULL) {
TIFFErrorExt(clientdata, module, "%s: Out of memory (TIFF structure)", name);
goto bad2;
@ -22,5 +25,5 @@ $OpenBSD: patch-libtiff_tif_open_c,v 1.1 2010/06/30 17:10:08 naddy Exp $
- strcpy(tif->tif_name, name);
+ strlcpy(tif->tif_name, name, namelen+1);
tif->tif_mode = m &~ (O_CREAT|O_TRUNC);
tif->tif_curdir = (tdir_t) -1; /* non-existent directory */
tif->tif_curdir = (uint16) -1; /* non-existent directory */
tif->tif_curoff = 0;

View File

@ -1,11 +1,11 @@
$OpenBSD: patch-libtiff_tiffiop_h,v 1.3 2012/04/09 17:35:38 naddy Exp $
$OpenBSD: patch-libtiff_tiffiop_h,v 1.4 2012/04/14 15:09:56 naddy Exp $
CVE-2012-1173: integer overflow
--- libtiff/tiffiop.h.orig Mon Mar 28 15:43:43 2011
+++ libtiff/tiffiop.h Mon Apr 9 19:26:57 2012
@@ -246,7 +246,7 @@ struct tiff {
#define TIFFroundup(x, y) (TIFFhowmany(x,y)*(y))
--- libtiff/tiffiop.h.orig Wed Apr 11 18:56:30 2012
+++ libtiff/tiffiop.h Wed Apr 11 18:56:58 2012
@@ -250,7 +250,7 @@ struct tiff {
#define TIFFroundup_64(x, y) (TIFFhowmany_64(x,y)*(y))
/* Safe multiply which returns zero if there is an integer overflow */
-#define TIFFSafeMultiply(t,v,m) ((((t)m != (t)0) && (((t)((v*m)/m)) == (t)v)) ? (t)(v*m) : (t)0)

View File

@ -1,10 +1,10 @@
$OpenBSD: patch-man_Makefile_in,v 1.10 2012/04/09 17:21:05 naddy Exp $
$OpenBSD: patch-man_Makefile_in,v 1.11 2012/04/14 15:09:56 naddy Exp $
Replace .3tiff man page suffix with standard .3
--- man/Makefile.in.orig Sat Feb 18 23:27:08 2012
+++ man/Makefile.in Mon Apr 9 19:13:44 2012
@@ -407,7 +407,7 @@ install-man3: $(dist_man3_MANS)
--- man/Makefile.in.orig Sat Feb 18 23:02:56 2012
+++ man/Makefile.in Wed Apr 11 18:57:31 2012
@@ -408,7 +408,7 @@ install-man3: $(dist_man3_MANS)
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-man_TIFFClose_3tiff,v 1.1 2008/10/25 09:39:29 naddy Exp $
--- man/TIFFClose.3tiff.orig Fri Oct 24 18:13:32 2008
+++ man/TIFFClose.3tiff Fri Oct 24 18:13:54 2008
@@ -40,7 +40,7 @@ Any buffered data are flushed to the file, including t
current directory (if modified); and all resources are reclaimed.
.SH DIAGNOSTICS
All error messages are directed to the
-.bR TIFFError (3TIFF)
+.BR TIFFError (3TIFF)
routine.
Likewise, warning messages are directed to the
.BR TIFFWarning (3TIFF)

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-man_raw2tiff_1,v 1.2 2010/06/30 17:10:08 naddy Exp $
--- man/raw2tiff.1.orig Thu Apr 20 14:17:19 2006
+++ man/raw2tiff.1 Sun Oct 11 15:07:53 2009
@@ -187,7 +187,7 @@ There is no magic, it is just a mathematical statistic
in some cases. But for most ordinary images guessing method will work fine.
.SH "SEE ALSO"
.BR pal2rgb (1),
-.bR tiffinfo (1),
+.BR tiffinfo (1),
.BR tiffcp (1),
.BR tiffmedian (1),
.BR libtiff (3)

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-man_tiffcmp_1,v 1.2 2010/06/30 17:10:08 naddy Exp $
--- man/tiffcmp.1.orig Thu Apr 20 14:17:19 2006
+++ man/tiffcmp.1 Sun Oct 11 15:07:53 2009
@@ -78,7 +78,7 @@ The pixel and/or sample number reported in differences
in some exotic cases.
.SH "SEE ALSO"
.BR pal2rgb (1),
-.bR tiffinfo (1),
+.BR tiffinfo (1),
.BR tiffcp (1),
.BR tiffmedian (1),
.BR libtiff (3TIFF)

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-man_tiffsplit_1,v 1.1 2008/10/25 09:39:29 naddy Exp $
--- man/tiffsplit.1.orig Fri Oct 24 18:27:26 2008
+++ man/tiffsplit.1 Fri Oct 24 18:27:47 2008
@@ -50,7 +50,7 @@ suffix in the range [\fIaaa\fP-\fIzzz\fP], the suffix
(e.g.
.IR xaaa.tif ,
.IR xaab.tif ,
-\...
+.IR ... ,
.IR xzzz.tif ).
If a prefix is not specified on the command line,
the default prefix of

View File

@ -1,10 +1,10 @@
$OpenBSD: patch-test_Makefile_in,v 1.3 2012/04/09 17:21:05 naddy Exp $
$OpenBSD: patch-test_Makefile_in,v 1.4 2012/04/14 15:09:56 naddy Exp $
Avoid picking up an old libtiff in ${LOCALBASE}.
--- test/Makefile.in.orig Sat Feb 18 23:27:08 2012
+++ test/Makefile.in Mon Apr 9 19:13:44 2012
@@ -293,10 +293,10 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
--- test/Makefile.in.orig Sat Feb 18 23:02:56 2012
+++ test/Makefile.in Wed Apr 11 19:06:33 2012
@@ -300,10 +300,10 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@

View File

@ -1,48 +0,0 @@
$OpenBSD: patch-tools_tiff2pdf_c,v 1.4 2011/05/09 08:14:43 giovanni Exp $
--- tools/tiff2pdf.c.orig Tue Dec 14 02:45:51 2010
+++ tools/tiff2pdf.c Thu Apr 21 15:35:54 2011
@@ -895,7 +895,7 @@ T2P* t2p_init()
if(t2p==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %u bytes of memory for t2p_init",
+ "Can't allocate %lu bytes of memory for t2p_init",
sizeof(T2P));
return( (T2P*) NULL );
}
@@ -1008,7 +1008,7 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if(t2p->tiff_pages==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %u bytes of memory for tiff_pages array, %s",
+ "Can't allocate %lu bytes of memory for tiff_pages array, %s",
directorycount * sizeof(T2P_PAGE),
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -1019,7 +1019,7 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if(t2p->tiff_tiles==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %u bytes of memory for tiff_tiles array, %s",
+ "Can't allocate %lu bytes of memory for tiff_tiles array, %s",
directorycount * sizeof(T2P_TILES),
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -1151,7 +1151,7 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if( t2p->tiff_tiles[i].tiles_tiles == NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %u bytes of memory for t2p_read_tiff_init, %s",
+ "Can't allocate %lu bytes of memory for t2p_read_tiff_init, %s",
t2p->tiff_tiles[i].tiles_tilecount * sizeof(T2P_TILE),
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -5143,7 +5143,7 @@ tsize_t t2p_write_pdf(T2P* t2p, TIFF* input, TIFF* out
if(t2p->pdf_xrefoffsets==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %u bytes of memory for t2p_write_pdf",
+ "Can't allocate %lu bytes of memory for t2p_write_pdf",
t2p->pdf_xrefcount * sizeof(uint32) );
return(written);
}

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.17 2010/06/30 17:10:08 naddy Exp $
@comment $OpenBSD: PLIST,v 1.18 2012/04/14 15:09:56 naddy Exp $
@bin bin/bmp2tiff
@bin bin/fax2ps
@bin bin/fax2tiff
@ -32,6 +32,8 @@ lib/libtiff.a
lib/libtiff.la
lib/libtiffxx.a
lib/libtiffxx.la
lib/pkgconfig/
lib/pkgconfig/libtiff-4.pc
@man man/man1/bmp2tiff.1
@man man/man1/fax2ps.1
@man man/man1/fax2tiff.1
@ -97,7 +99,14 @@ lib/libtiffxx.la
@man man/man3/TIFFtile.3
@man man/man3/libtiff.3
share/doc/tiff/
share/doc/tiff/COPYRIGHT
share/doc/tiff/ChangeLog
share/doc/tiff/README
share/doc/tiff/README.vms
share/doc/tiff/RELEASE-DATE
share/doc/tiff/TIFFTechNote2.html
share/doc/tiff/TODO
share/doc/tiff/VERSION
share/doc/tiff/addingtags.html
share/doc/tiff/bugs.html
share/doc/tiff/build.html
@ -228,3 +237,4 @@ share/doc/tiff/v3.8.2.html
share/doc/tiff/v3.9.0beta.html
share/doc/tiff/v3.9.1.html
share/doc/tiff/v3.9.2.html
share/doc/tiff/v4.0.0.html