head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.44 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.42 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.40 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.38 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.36 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.2.0.34 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.2.0.32 pkgsrc-2008Q3-base:1.2 cube-native-xorg:1.2.0.30 cube-native-xorg-base:1.2 pkgsrc-2008Q2:1.2.0.28 pkgsrc-2008Q2-base:1.2 pkgsrc-2008Q1:1.2.0.26 pkgsrc-2008Q1-base:1.2 pkgsrc-2007Q4:1.2.0.24 pkgsrc-2007Q4-base:1.2 pkgsrc-2007Q3:1.2.0.22 pkgsrc-2007Q3-base:1.2 pkgsrc-2007Q2:1.2.0.20 pkgsrc-2007Q2-base:1.2 pkgsrc-2007Q1:1.2.0.18 pkgsrc-2007Q1-base:1.2 pkgsrc-2006Q4:1.2.0.16 pkgsrc-2006Q4-base:1.2 pkgsrc-2006Q3:1.2.0.14 pkgsrc-2006Q3-base:1.2 pkgsrc-2006Q2:1.2.0.12 pkgsrc-2006Q2-base:1.2 pkgsrc-2006Q1:1.2.0.10 pkgsrc-2006Q1-base:1.2 pkgsrc-2005Q4:1.2.0.8 pkgsrc-2005Q4-base:1.2 pkgsrc-2005Q3:1.2.0.6 pkgsrc-2005Q3-base:1.2 pkgsrc-2005Q2:1.2.0.4 pkgsrc-2005Q2-base:1.2 pkgsrc-2005Q1:1.2.0.2 pkgsrc-2005Q1-base:1.2 pkgsrc-2004Q4:1.1.0.4 pkgsrc-2004Q4-base:1.1 pkgsrc-2004Q3:1.1.0.2; locks; strict; comment @# @; 1.2 date 2004.12.28.23.10.09; author reed; state dead; branches; next 1.1; 1.1 date 2004.10.18.14.37.24; author tron; state Exp; branches 1.1.2.1; next ; 1.1.2.1 date 2004.10.18.14.37.24; author agc; state dead; branches; next 1.1.2.2; 1.1.2.2 date 2004.10.18.17.03.48; author agc; state Exp; branches; next ; desc @@ 1.2 log @Upgrade tiff to 3.7.1. Remove OpenWindows workaround in pkgsrc for this. Too many changes to include here. See http://www.remotesensing.org/libtiff/v3.7.1.html and http://www.remotesensing.org/libtiff/v3.7.0.html and previous change files for changes information. tiff-3.7.1 now includes the lzw compression code again. It also uses autoconf and libtool now. A new tool is bmp2tiff. Docs are placed under share/doc/tiff/html instead of share/doc/html/tiff. Many manpage symlinks are now missing. (This was reported to tiff list.) @ text @$NetBSD: patch-aj,v 1.1 2004/10/18 14:37:24 tron Exp $ --- libtiff/tif_aux.c.orig 2003-12-07 12:58:36.000000000 +0100 +++ libtiff/tif_aux.c 2004-10-18 16:25:32.000000000 +0200 @@@@ -33,36 +33,59 @@@@ #include "tif_predict.h" #include -static void +static int TIFFDefaultTransferFunction(TIFFDirectory* td) { uint16 **tf = td->td_transferfunction; - long i, n = 1<td_bitspersample; + tsize_t i, n, nbytes; - tf[0] = (uint16 *)_TIFFmalloc(n * sizeof (uint16)); + tf[0] = tf[1] = tf[2] = 0; + if (td->td_bitspersample >= sizeof(tsize_t) * 8 - 2) + return 0; + + n = 1<td_bitspersample; + nbytes = n * sizeof (uint16); + if (!(tf[0] = (uint16 *)_TIFFmalloc(nbytes))) + return 0; tf[0][0] = 0; for (i = 1; i < n; i++) { double t = (double)i/((double) n-1.); tf[0][i] = (uint16)floor(65535.*pow(t, 2.2) + .5); } + if (td->td_samplesperpixel - td->td_extrasamples > 1) { - tf[1] = (uint16 *)_TIFFmalloc(n * sizeof (uint16)); - _TIFFmemcpy(tf[1], tf[0], n * sizeof (uint16)); - tf[2] = (uint16 *)_TIFFmalloc(n * sizeof (uint16)); - _TIFFmemcpy(tf[2], tf[0], n * sizeof (uint16)); + if (!(tf[1] = (uint16 *)_TIFFmalloc(nbytes))) + goto bad; + _TIFFmemcpy(tf[1], tf[0], nbytes); + if (!(tf[2] = (uint16 *)_TIFFmalloc(nbytes))) + goto bad; + _TIFFmemcpy(tf[2], tf[0], nbytes); } + return 1; + +bad: + if (tf[0]) + _TIFFfree(tf[0]); + if (tf[1]) + _TIFFfree(tf[1]); + if (tf[2]) + _TIFFfree(tf[2]); + tf[0] = tf[1] = tf[2] = 0; + return 0; } -static void +static int TIFFDefaultRefBlackWhite(TIFFDirectory* td) { int i; - td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float)); + if (!(td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float)))) + return 0; for (i = 0; i < 3; i++) { td->td_refblackwhite[2*i+0] = 0; td->td_refblackwhite[2*i+1] = (float)((1L<td_bitspersample)-1L); } + return 1; } /* @@@@ -155,6 +178,8 @@@@ if (!td->td_ycbcrcoeffs) { td->td_ycbcrcoeffs = (float *) _TIFFmalloc(3*sizeof (float)); + if (!td->td_ycbcrcoeffs) + return (0); /* defaults are from CCIR Recommendation 601-1 */ td->td_ycbcrcoeffs[0] = 0.299f; td->td_ycbcrcoeffs[1] = 0.587f; @@@@ -173,6 +198,8 @@@@ if (!td->td_whitepoint) { td->td_whitepoint = (float *) _TIFFmalloc(2 * sizeof (float)); + if (!td->td_whitepoint) + return (0); /* TIFF 6.0 specification says that it is no default value for the WhitePoint, but AdobePhotoshop TIFF Technical Note tells that it should be CIE D50. */ @@@@ -184,8 +211,11 @@@@ *va_arg(ap, float **) = td->td_whitepoint; return (1); case TIFFTAG_TRANSFERFUNCTION: - if (!td->td_transferfunction[0]) - TIFFDefaultTransferFunction(td); + if (!td->td_transferfunction[0] && + !TIFFDefaultTransferFunction(td)) { + TIFFError(tif->tif_name, "No space for \"TransferFunction\" tag"); + return (0); + } *va_arg(ap, uint16 **) = td->td_transferfunction[0]; if (td->td_samplesperpixel - td->td_extrasamples > 1) { *va_arg(ap, uint16 **) = td->td_transferfunction[1]; @@@@ -193,8 +223,8 @@@@ } return (1); case TIFFTAG_REFERENCEBLACKWHITE: - if (!td->td_refblackwhite) - TIFFDefaultRefBlackWhite(td); + if (!td->td_refblackwhite && !TIFFDefaultRefBlackWhite(td)) + return (0); *va_arg(ap, float **) = td->td_refblackwhite; return (1); } @ 1.1 log @Add various bug fixes taken from Debian's unstable distribution which include fixes for CESA-2004-006. Bump package revision. @ text @d1 1 a1 1 $NetBSD$ @ 1.1.2.1 log @file patch-aj was added on branch pkgsrc-2004Q3 on 2004-10-18 14:37:24 +0000 @ text @d1 116 @ 1.1.2.2 log @Pullup ticket 122 - requested by Matthias Scheler security fix for tiff Modified Files: pkgsrc/graphics/tiff: Makefile Log Message: Derive "PKGNAME" from "DISTNAME" instead of defining it manually. Modified Files: pkgsrc/graphics/tiff: Makefile Log Message: Add mirror on "ftp.fu-berlin.de" to master site list. Modified Files: pkgsrc/graphics/tiff: Makefile distinfo pkgsrc/graphics/tiff/patches: patch-ag Added Files: pkgsrc/graphics/tiff/patches: patch-ai patch-aj patch-ak patch-al patch-am patch-an patch-ao patch-ap patch-aq patch-ar patch-as patch-at patch-au patch-av patch-aw patch-ax Log Message: Add various bug fixes taken from Debian's unstable distribution which include fixes for CESA-2004-006. Bump package revision. @ text @a0 116 $NetBSD: patch-aj,v 1.1.2.1 2004/10/18 17:03:48 agc Exp $ --- libtiff/tif_aux.c.orig 2003-12-07 12:58:36.000000000 +0100 +++ libtiff/tif_aux.c 2004-10-18 16:25:32.000000000 +0200 @@@@ -33,36 +33,59 @@@@ #include "tif_predict.h" #include -static void +static int TIFFDefaultTransferFunction(TIFFDirectory* td) { uint16 **tf = td->td_transferfunction; - long i, n = 1<td_bitspersample; + tsize_t i, n, nbytes; - tf[0] = (uint16 *)_TIFFmalloc(n * sizeof (uint16)); + tf[0] = tf[1] = tf[2] = 0; + if (td->td_bitspersample >= sizeof(tsize_t) * 8 - 2) + return 0; + + n = 1<td_bitspersample; + nbytes = n * sizeof (uint16); + if (!(tf[0] = (uint16 *)_TIFFmalloc(nbytes))) + return 0; tf[0][0] = 0; for (i = 1; i < n; i++) { double t = (double)i/((double) n-1.); tf[0][i] = (uint16)floor(65535.*pow(t, 2.2) + .5); } + if (td->td_samplesperpixel - td->td_extrasamples > 1) { - tf[1] = (uint16 *)_TIFFmalloc(n * sizeof (uint16)); - _TIFFmemcpy(tf[1], tf[0], n * sizeof (uint16)); - tf[2] = (uint16 *)_TIFFmalloc(n * sizeof (uint16)); - _TIFFmemcpy(tf[2], tf[0], n * sizeof (uint16)); + if (!(tf[1] = (uint16 *)_TIFFmalloc(nbytes))) + goto bad; + _TIFFmemcpy(tf[1], tf[0], nbytes); + if (!(tf[2] = (uint16 *)_TIFFmalloc(nbytes))) + goto bad; + _TIFFmemcpy(tf[2], tf[0], nbytes); } + return 1; + +bad: + if (tf[0]) + _TIFFfree(tf[0]); + if (tf[1]) + _TIFFfree(tf[1]); + if (tf[2]) + _TIFFfree(tf[2]); + tf[0] = tf[1] = tf[2] = 0; + return 0; } -static void +static int TIFFDefaultRefBlackWhite(TIFFDirectory* td) { int i; - td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float)); + if (!(td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float)))) + return 0; for (i = 0; i < 3; i++) { td->td_refblackwhite[2*i+0] = 0; td->td_refblackwhite[2*i+1] = (float)((1L<td_bitspersample)-1L); } + return 1; } /* @@@@ -155,6 +178,8 @@@@ if (!td->td_ycbcrcoeffs) { td->td_ycbcrcoeffs = (float *) _TIFFmalloc(3*sizeof (float)); + if (!td->td_ycbcrcoeffs) + return (0); /* defaults are from CCIR Recommendation 601-1 */ td->td_ycbcrcoeffs[0] = 0.299f; td->td_ycbcrcoeffs[1] = 0.587f; @@@@ -173,6 +198,8 @@@@ if (!td->td_whitepoint) { td->td_whitepoint = (float *) _TIFFmalloc(2 * sizeof (float)); + if (!td->td_whitepoint) + return (0); /* TIFF 6.0 specification says that it is no default value for the WhitePoint, but AdobePhotoshop TIFF Technical Note tells that it should be CIE D50. */ @@@@ -184,8 +211,11 @@@@ *va_arg(ap, float **) = td->td_whitepoint; return (1); case TIFFTAG_TRANSFERFUNCTION: - if (!td->td_transferfunction[0]) - TIFFDefaultTransferFunction(td); + if (!td->td_transferfunction[0] && + !TIFFDefaultTransferFunction(td)) { + TIFFError(tif->tif_name, "No space for \"TransferFunction\" tag"); + return (0); + } *va_arg(ap, uint16 **) = td->td_transferfunction[0]; if (td->td_samplesperpixel - td->td_extrasamples > 1) { *va_arg(ap, uint16 **) = td->td_transferfunction[1]; @@@@ -193,8 +223,8 @@@@ } return (1); case TIFFTAG_REFERENCEBLACKWHITE: - if (!td->td_refblackwhite) - TIFFDefaultRefBlackWhite(td); + if (!td->td_refblackwhite && !TIFFDefaultRefBlackWhite(td)) + return (0); *va_arg(ap, float **) = td->td_refblackwhite; return (1); } @