summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/tiff')
-rw-r--r--media-libs/tiff/Manifest8
-rw-r--r--media-libs/tiff/README65
-rw-r--r--media-libs/tiff/files/tiff-3.8.2-goo-sec.patch669
-rw-r--r--media-libs/tiff/files/tiff-3.8.2-tiffsplit.patch20
-rw-r--r--media-libs/tiff/files/tiff-buffer.patch11
-rw-r--r--media-libs/tiff/files/tiff-jbig.patch510
-rw-r--r--media-libs/tiff/tiff-3.8.2-r3.ebuild57
7 files changed, 0 insertions, 1340 deletions
diff --git a/media-libs/tiff/Manifest b/media-libs/tiff/Manifest
deleted file mode 100644
index f2ebdef..0000000
--- a/media-libs/tiff/Manifest
+++ /dev/null
@@ -1,8 +0,0 @@
-AUX tiff-3.8.2-goo-sec.patch 23249 RMD160 088a2dae843d8b29b8d45a3dbac6ff744053b270 SHA1 85dc50a60a10025757e249d869dab7eb73ba6e3c SHA256 a39643c732afbe11b7dbdc64db352f172a549c0f0bf47b08e598c231909240aa
-AUX tiff-3.8.2-tiffsplit.patch 646 RMD160 14633a8b89b71f6c9aa027c25233854331d8633f SHA1 445b7bbdeaadf8362127173a4908f7e5f31ac30d SHA256 79f88d303634d52478fe36fff972aa133d3bf1d23ab4c8ad35d3baba40461a48
-AUX tiff-buffer.patch 461 RMD160 d3cfd4c59d51c8eacf1bde2b3d840dec1be6294d SHA1 7efceeec3d93a4a8b4a3cbb256b5bbc274a30f39 SHA256 c312510be0f5f77008b3eab627733fbb175b869cf9d3bc6d6b424b7117d70548
-AUX tiff-jbig.patch 14636 RMD160 88f8069cda0e1a897961e2c69e6b787a7776124d SHA1 293c174bd1137c63a85dbfc761616752d2f3644f SHA256 73e70f6cf3e63abfd7b5569e2aae0a6811020c883065dfc36d563ca2e547ccd1
-DIST tiff-3.8.2-tiff2pdf.patch.bz2 8469 RMD160 735c468464fcd4662ac571ae4a92ae1e20a4736e SHA1 c121f0ba43cde1eb9b667ae55b9cab94f1fb83ff SHA256 1811b0ea3a7e1b09b398731a60aded50cea48a80347b3196fdbfe75cf9e878b9
-DIST tiff-3.8.2.tar.gz 1336295 RMD160 1b4d825e3be08764e953fc58246d0c25ab4dd17d SHA1 549e67b6a15b42bfcd72fe17cda7c9a198a393eb SHA256 be88f037080b93ce0a337b2b3ca5e8195f76885deb6c558cc3aa872ee848fc76
-EBUILD tiff-3.8.2-r3.ebuild 1637 RMD160 2c7d9614f0dfcfa271ffacb044a42ef14c056a57 SHA1 3503526cb266e72f769b7d79bbe87fdbe75a33bd SHA256 865a980bed5e628041cf30cd6c5643366a1dcdc86df4c58932398b75de480f3a
-MISC README 3065 RMD160 01bff30f33944bdea33eef27a97770ebe90a8f50 SHA1 9a77c2aa4edeba4fcdbc188b26a4373f9e62ac02 SHA256 325e14fdffe2798675672b12c24e6c8ce12092f81e532277520d5044a3decb20
diff --git a/media-libs/tiff/README b/media-libs/tiff/README
deleted file mode 100644
index 85f41ea..0000000
--- a/media-libs/tiff/README
+++ /dev/null
@@ -1,65 +0,0 @@
-tiff with enabled old-jpeg support. Do not forgive recompile jpeg with patch
-(jdhuff_add.c) from tiff.
-
-I though this helps me to read M$ tiff files, but I was wrong. Even after
-patching I receive the following error:
-
-unknown field with tag 37679 (0x932f) encountered. `TIFFReadDirectory'.
-unknown field with tag 37680 (0x9330) encountered. `TIFFReadDirectory'.
-unknown field with tag 37681 (0x9331) encountered. `TIFFReadDirectory'.
-
-Well. Just found some other information, that may be of interest for somebody
-reading this README file.
-
-From Ubuntu Bugzilla:
-
-
-Re: crash in tiff loader from Michael R. Head at 2006-09-21 00:00:59 UTC
-
-My brother emails me tiffs of magazine articles from work generated by the
-scanning system they have in place there. They always have this problem. He's
-not very tech-savvy, so he may not be able to configure the system to generate
-proper tiffs.
-
-Anyway, I've gone through the trouble of compiling libtiff with the "old jpeg"
-support after patching and recompiling libjpeg. After doing this, I still can't
-view the file:
-
-burner@firefighter:/tmp$ /tmp/jpg/bin/tiffinfo ~/Desktop/WELL\ LET\ ME.tif
-TIFFReadDirectory: Warning, /home/burner/Desktop/WELL LET ME.tif: unknown field with tag 37679 (0x932f) encountered.
-TIFFReadDirectory: Warning, /home/burner/Desktop/WELL LET ME.tif: unknown field with tag 37680 (0x9330) encountered.
-TIFFReadDirectory: Warning, /home/burner/Desktop/WELL LET ME.tif: unknown field with tag 37681 (0x9331) encountered.
-/home/burner/Desktop/WELL LET ME.tif: Invalid YCbCr subsampling.
-TIFFReadDirectory: /home/burner/Desktop/WELL LET ME.tif: cannot handle zero strip size.
-
-As you can see, the last 3 unknown fields are present, but I've managed to get
-libtiff to understand the takes 513 and 514. Sadly, I still can't get the data
-out.
-
-I've collected information on this from the following links (for those that may
-find this bug report in the future):
-http://bugzilla.remotesensing.org/show_bug.cgi?id=156
-http://www.awaresystems.be/imaging/tiff/tifftags/jpeginterchangeformat.html
-http://www.remotesensing.org/libtiff/TIFFTechNote2.html
-
-I've gone so far as to run Windows' own tiff viewer, and that still couldn't
-extract the image data.
-
-End result: if you get your hands on one of these "old style jpeg in tiff"
-files, you're pretty much out of luck. You'll have to negotiate with the file
-supplier to provide it in a different format.
-
-
-Re: crash in tiff loader from Michael R. Head at 2006-09-22 06:53:28 UTC
-
-OK, maybe you won't be out of luck. After reading Pete Savage's blog post about
-recovering data, I was able to extract the jpeg living inside my tiff and
-finally view the image as intended. Others may find the "foremost" program
-helpful: https://launchpad.net/distros/ubuntu/+source/foremost
-
-foremost was able to discover 2 jpegs (one thumbnail as well as the original
-scan) and an OLE document inside the evil TIFF, and it extracted them into
-their own files. Just run it like so: "foremost evil.tiff" and it'll put all
-the files it finds underneath and "output" directory.
-
-
diff --git a/media-libs/tiff/files/tiff-3.8.2-goo-sec.patch b/media-libs/tiff/files/tiff-3.8.2-goo-sec.patch
deleted file mode 100644
index cb55b03..0000000
--- a/media-libs/tiff/files/tiff-3.8.2-goo-sec.patch
+++ /dev/null
@@ -1,669 +0,0 @@
-diff -ru tiff-3.8.2/libtiff/tif_dir.c tiff-3.8.2-goo/libtiff/tif_dir.c
---- tiff-3.8.2/libtiff/tif_dir.c 2006-03-21 16:42:50.000000000 +0000
-+++ tiff-3.8.2-goo/libtiff/tif_dir.c 2006-07-14 13:52:01.027562000 +0100
-@@ -122,6 +122,7 @@
- {
- static const char module[] = "_TIFFVSetField";
-
-+ const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
- TIFFDirectory* td = &tif->tif_dir;
- int status = 1;
- uint32 v32, i, v;
-@@ -195,10 +196,12 @@
- break;
- case TIFFTAG_ORIENTATION:
- v = va_arg(ap, uint32);
-+ const TIFFFieldInfo* fip;
- if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v) {
-+ fip = _TIFFFieldWithTag(tif, tag);
- TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
- "Bad value %lu for \"%s\" tag ignored",
-- v, _TIFFFieldWithTag(tif, tag)->field_name);
-+ v, fip ? fip->field_name : "Unknown");
- } else
- td->td_orientation = (uint16) v;
- break;
-@@ -387,11 +390,15 @@
- * happens, for example, when tiffcp is used to convert between
- * compression schemes and codec-specific tags are blindly copied.
- */
-+ /*
-+ * better not dereference fip if it is NULL.
-+ * -- taviso@google.com 15 Jun 2006
-+ */
- if(fip == NULL || fip->field_bit != FIELD_CUSTOM) {
- TIFFErrorExt(tif->tif_clientdata, module,
- "%s: Invalid %stag \"%s\" (not supported by codec)",
- tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
-- _TIFFFieldWithTag(tif, tag)->field_name);
-+ fip ? fip->field_name : "Unknown");
- status = 0;
- break;
- }
-@@ -468,7 +475,7 @@
- if (fip->field_type == TIFF_ASCII)
- _TIFFsetString((char **)&tv->value, va_arg(ap, char *));
- else {
-- tv->value = _TIFFmalloc(tv_size * tv->count);
-+ tv->value = _TIFFCheckMalloc(tif, tv_size, tv->count, "Tag Value");
- if (!tv->value) {
- status = 0;
- goto end;
-@@ -563,7 +570,7 @@
- }
- }
- if (status) {
-- TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
-+ TIFFSetFieldBit(tif, fip->field_bit);
- tif->tif_flags |= TIFF_DIRTYDIRECT;
- }
-
-@@ -572,12 +579,12 @@
- return (status);
- badvalue:
- TIFFErrorExt(tif->tif_clientdata, module, "%s: Bad value %d for \"%s\"",
-- tif->tif_name, v, _TIFFFieldWithTag(tif, tag)->field_name);
-+ tif->tif_name, v, fip ? fip->field_name : "Unknown");
- va_end(ap);
- return (0);
- badvalue32:
- TIFFErrorExt(tif->tif_clientdata, module, "%s: Bad value %ld for \"%s\"",
-- tif->tif_name, v32, _TIFFFieldWithTag(tif, tag)->field_name);
-+ tif->tif_name, v32, fip ? fip->field_name : "Unknown");
- va_end(ap);
- return (0);
- }
-@@ -813,12 +820,16 @@
- * If the client tries to get a tag that is not valid
- * for the image's codec then we'll arrive here.
- */
-+ /*
-+ * dont dereference fip if it's NULL.
-+ * -- taviso@google.com 15 Jun 2006
-+ */
- if( fip == NULL || fip->field_bit != FIELD_CUSTOM )
- {
- TIFFErrorExt(tif->tif_clientdata, "_TIFFVGetField",
- "%s: Invalid %stag \"%s\" (not supported by codec)",
- tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
-- _TIFFFieldWithTag(tif, tag)->field_name);
-+ fip ? fip->field_name : "Unknown");
- ret_val = 0;
- break;
- }
-diff -ru tiff-3.8.2/libtiff/tif_dirinfo.c tiff-3.8.2-goo/libtiff/tif_dirinfo.c
---- tiff-3.8.2/libtiff/tif_dirinfo.c 2006-02-07 13:51:03.000000000 +0000
-+++ tiff-3.8.2-goo/libtiff/tif_dirinfo.c 2006-07-14 13:52:00.953558000 +0100
-@@ -775,7 +775,8 @@
- TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithTag",
- "Internal error, unknown tag 0x%x",
- (unsigned int) tag);
-- assert(fip != NULL);
-+ /* assert(fip != NULL); */
-+
- /*NOTREACHED*/
- }
- return (fip);
-@@ -789,7 +790,8 @@
- if (!fip) {
- TIFFErrorExt(tif->tif_clientdata, "TIFFFieldWithName",
- "Internal error, unknown tag %s", field_name);
-- assert(fip != NULL);
-+ /* assert(fip != NULL); */
-+
- /*NOTREACHED*/
- }
- return (fip);
-diff -ru tiff-3.8.2/libtiff/tif_dirread.c tiff-3.8.2-goo/libtiff/tif_dirread.c
---- tiff-3.8.2/libtiff/tif_dirread.c 2006-03-21 16:42:50.000000000 +0000
-+++ tiff-3.8.2-goo/libtiff/tif_dirread.c 2006-07-14 13:52:00.842557000 +0100
-@@ -29,6 +29,9 @@
- *
- * Directory Read Support Routines.
- */
-+
-+#include <limits.h>
-+
- #include "tiffiop.h"
-
- #define IGNORE 0 /* tag placeholder used below */
-@@ -81,6 +84,7 @@
- uint16 dircount;
- toff_t nextdiroff;
- int diroutoforderwarning = 0;
-+ int compressionknown = 0;
- toff_t* new_dirlist;
-
- tif->tif_diroff = tif->tif_nextdiroff;
-@@ -147,13 +151,20 @@
- } else {
- toff_t off = tif->tif_diroff;
-
-- if (off + sizeof (uint16) > tif->tif_size) {
-- TIFFErrorExt(tif->tif_clientdata, module,
-- "%s: Can not read TIFF directory count",
-- tif->tif_name);
-- return (0);
-+ /*
-+ * Check for integer overflow when validating the dir_off, otherwise
-+ * a very high offset may cause an OOB read and crash the client.
-+ * -- taviso@google.com, 14 Jun 2006.
-+ */
-+ if (off + sizeof (uint16) > tif->tif_size ||
-+ off > (UINT_MAX - sizeof(uint16))) {
-+ TIFFErrorExt(tif->tif_clientdata, module,
-+ "%s: Can not read TIFF directory count",
-+ tif->tif_name);
-+ return (0);
- } else
-- _TIFFmemcpy(&dircount, tif->tif_base + off, sizeof (uint16));
-+ _TIFFmemcpy(&dircount, tif->tif_base + off,
-+ sizeof (uint16));
- off += sizeof (uint16);
- if (tif->tif_flags & TIFF_SWAB)
- TIFFSwabShort(&dircount);
-@@ -254,6 +265,7 @@
- while (fix < tif->tif_nfields &&
- tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)
- fix++;
-+
- if (fix >= tif->tif_nfields ||
- tif->tif_fieldinfo[fix]->field_tag != dp->tdir_tag) {
-
-@@ -264,17 +276,23 @@
- dp->tdir_tag,
- dp->tdir_tag,
- dp->tdir_type);
--
-- TIFFMergeFieldInfo(tif,
-- _TIFFCreateAnonFieldInfo(tif,
-- dp->tdir_tag,
-- (TIFFDataType) dp->tdir_type),
-- 1 );
-+ /*
-+ * creating anonymous fields prior to knowing the compression
-+ * algorithm (ie, when the field info has been merged) could cause
-+ * crashes with pathological directories.
-+ * -- taviso@google.com 15 Jun 2006
-+ */
-+ if (compressionknown)
-+ TIFFMergeFieldInfo(tif, _TIFFCreateAnonFieldInfo(tif, dp->tdir_tag,
-+ (TIFFDataType) dp->tdir_type), 1 );
-+ else goto ignore;
-+
- fix = 0;
- while (fix < tif->tif_nfields &&
- tif->tif_fieldinfo[fix]->field_tag < dp->tdir_tag)
- fix++;
- }
-+
- /*
- * Null out old tags that we ignore.
- */
-@@ -326,6 +344,7 @@
- dp->tdir_type, dp->tdir_offset);
- if (!TIFFSetField(tif, dp->tdir_tag, (uint16)v))
- goto bad;
-+ else compressionknown++;
- break;
- /* XXX: workaround for broken TIFFs */
- } else if (dp->tdir_type == TIFF_LONG) {
-@@ -540,6 +559,7 @@
- * Attempt to deal with a missing StripByteCounts tag.
- */
- if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS)) {
-+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, TIFFTAG_STRIPBYTECOUNTS);
- /*
- * Some manufacturers violate the spec by not giving
- * the size of the strips. In this case, assume there
-@@ -556,7 +576,7 @@
- "%s: TIFF directory is missing required "
- "\"%s\" field, calculating from imagelength",
- tif->tif_name,
-- _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
-+ fip ? fip->field_name : "Unknown");
- if (EstimateStripByteCounts(tif, dir, dircount) < 0)
- goto bad;
- /*
-@@ -580,6 +600,7 @@
- } else if (td->td_nstrips == 1
- && td->td_stripoffset[0] != 0
- && BYTECOUNTLOOKSBAD) {
-+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, TIFFTAG_STRIPBYTECOUNTS);
- /*
- * XXX: Plexus (and others) sometimes give a value of zero for
- * a tag when they don't know what the correct value is! Try
-@@ -589,13 +610,14 @@
- TIFFWarningExt(tif->tif_clientdata, module,
- "%s: Bogus \"%s\" field, ignoring and calculating from imagelength",
- tif->tif_name,
-- _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
-+ fip ? fip->field_name : "Unknown");
- if(EstimateStripByteCounts(tif, dir, dircount) < 0)
- goto bad;
- } else if (td->td_planarconfig == PLANARCONFIG_CONTIG
- && td->td_nstrips > 2
- && td->td_compression == COMPRESSION_NONE
- && td->td_stripbytecount[0] != td->td_stripbytecount[1]) {
-+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, TIFFTAG_STRIPBYTECOUNTS);
- /*
- * XXX: Some vendors fill StripByteCount array with absolutely
- * wrong values (it can be equal to StripOffset array, for
-@@ -604,7 +626,7 @@
- TIFFWarningExt(tif->tif_clientdata, module,
- "%s: Wrong \"%s\" field, ignoring and calculating from imagelength",
- tif->tif_name,
-- _TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
-+ fip ? fip->field_name : "Unknown");
- if (EstimateStripByteCounts(tif, dir, dircount) < 0)
- goto bad;
- }
-@@ -870,7 +892,13 @@
-
- register TIFFDirEntry *dp;
- register TIFFDirectory *td = &tif->tif_dir;
-- uint16 i;
-+
-+ /* i is used to iterate over td->td_nstrips, so must be
-+ * at least the same width.
-+ * -- taviso@google.com 15 Jun 2006
-+ */
-+
-+ uint32 i;
-
- if (td->td_stripbytecount)
- _TIFFfree(td->td_stripbytecount);
-@@ -947,16 +975,18 @@
- static int
- CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)
- {
-+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
-+
- if (count > dir->tdir_count) {
- TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
- "incorrect count for field \"%s\" (%lu, expecting %lu); tag ignored",
-- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
-+ fip ? fip->field_name : "Unknown",
- dir->tdir_count, count);
- return (0);
- } else if (count < dir->tdir_count) {
- TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
- "incorrect count for field \"%s\" (%lu, expecting %lu); tag trimmed",
-- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name,
-+ fip ? fip->field_name : "Unknown",
- dir->tdir_count, count);
- return (1);
- }
-@@ -970,6 +1000,7 @@
- TIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)
- {
- int w = TIFFDataWidth((TIFFDataType) dir->tdir_type);
-+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
- tsize_t cc = dir->tdir_count * w;
-
- /* Check for overflow. */
-@@ -1013,7 +1044,7 @@
- bad:
- TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
- "Error fetching data for field \"%s\"",
-- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
-+ fip ? fip->field_name : "Unknown");
- return (tsize_t) 0;
- }
-
-@@ -1039,10 +1070,12 @@
- static int
- cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)
- {
-+ const TIFFFieldInfo* fip;
- if (denom == 0) {
-+ fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
- TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
- "%s: Rational with zero denominator (num = %lu)",
-- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name, num);
-+ fip ? fip->field_name : "Unknown", num);
- return (0);
- } else {
- if (dir->tdir_type == TIFF_RATIONAL)
-@@ -1159,6 +1192,20 @@
- static int
- TIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir)
- {
-+ /*
-+ * Prevent overflowing the v stack arrays below by performing a sanity
-+ * check on tdir_count, this should never be greater than two.
-+ * -- taviso@google.com 14 Jun 2006.
-+ */
-+ if (dir->tdir_count > 2) {
-+ const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
-+ TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
-+ "unexpected count for field \"%s\", %lu, expected 2; ignored.",
-+ fip ? fip->field_name : "Unknown",
-+ dir->tdir_count);
-+ return 0;
-+ }
-+
- switch (dir->tdir_type) {
- case TIFF_BYTE:
- case TIFF_SBYTE:
-@@ -1329,14 +1376,15 @@
- case TIFF_DOUBLE:
- return (TIFFFetchDoubleArray(tif, dir, (double*) v));
- default:
-+ { const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
- /* TIFF_NOTYPE */
- /* TIFF_ASCII */
- /* TIFF_UNDEFINED */
- TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
- "cannot read TIFF_ANY type %d for field \"%s\"",
- dir->tdir_type,
-- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
-- return (0);
-+ fip ? fip->field_name : "Unknown");
-+ return (0); }
- }
- return (1);
- }
-@@ -1351,6 +1399,9 @@
- int ok = 0;
- const TIFFFieldInfo* fip = _TIFFFieldWithTag(tif, dp->tdir_tag);
-
-+ if (fip == NULL) {
-+ return (0);
-+ }
- if (dp->tdir_count > 1) { /* array of values */
- char* cp = NULL;
-
-@@ -1493,6 +1544,7 @@
- TIFFFetchPerSampleShorts(TIFF* tif, TIFFDirEntry* dir, uint16* pl)
- {
- uint16 samples = tif->tif_dir.td_samplesperpixel;
-+ const TIFFFieldInfo* fip;
- int status = 0;
-
- if (CheckDirCount(tif, dir, (uint32) samples)) {
-@@ -1510,9 +1562,10 @@
-
- for (i = 1; i < check_count; i++)
- if (v[i] != v[0]) {
-+ fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
- TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
- "Cannot handle different per-sample values for field \"%s\"",
-- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
-+ fip ? fip->field_name : "Unknown");
- goto bad;
- }
- *pl = v[0];
-@@ -1534,6 +1587,7 @@
- TIFFFetchPerSampleLongs(TIFF* tif, TIFFDirEntry* dir, uint32* pl)
- {
- uint16 samples = tif->tif_dir.td_samplesperpixel;
-+ const TIFFFieldInfo* fip;
- int status = 0;
-
- if (CheckDirCount(tif, dir, (uint32) samples)) {
-@@ -1551,9 +1605,10 @@
- check_count = samples;
- for (i = 1; i < check_count; i++)
- if (v[i] != v[0]) {
-+ fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
- TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
- "Cannot handle different per-sample values for field \"%s\"",
-- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
-+ fip ? fip->field_name : "Unknown");
- goto bad;
- }
- *pl = v[0];
-@@ -1574,6 +1629,7 @@
- TIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* pl)
- {
- uint16 samples = tif->tif_dir.td_samplesperpixel;
-+ const TIFFFieldInfo* fip;
- int status = 0;
-
- if (CheckDirCount(tif, dir, (uint32) samples)) {
-@@ -1591,9 +1647,10 @@
-
- for (i = 1; i < check_count; i++)
- if (v[i] != v[0]) {
-+ fip = _TIFFFieldWithTag(tif, dir->tdir_tag);
- TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
- "Cannot handle different per-sample values for field \"%s\"",
-- _TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
-+ fip ? fip->field_name : "Unknown");
- goto bad;
- }
- *pl = v[0];
-diff -ru tiff-3.8.2/libtiff/tif_fax3.c tiff-3.8.2-goo/libtiff/tif_fax3.c
---- tiff-3.8.2/libtiff/tif_fax3.c 2006-03-21 16:42:50.000000000 +0000
-+++ tiff-3.8.2-goo/libtiff/tif_fax3.c 2006-07-14 13:52:00.669557000 +0100
-@@ -1136,6 +1136,7 @@
- Fax3VSetField(TIFF* tif, ttag_t tag, va_list ap)
- {
- Fax3BaseState* sp = Fax3State(tif);
-+ const TIFFFieldInfo* fip;
-
- assert(sp != 0);
- assert(sp->vsetparent != 0);
-@@ -1181,7 +1182,13 @@
- default:
- return (*sp->vsetparent)(tif, tag, ap);
- }
-- TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
-+
-+ if ((fip = _TIFFFieldWithTag(tif, tag))) {
-+ TIFFSetFieldBit(tif, fip->field_bit);
-+ } else {
-+ return (0);
-+ }
-+
- tif->tif_flags |= TIFF_DIRTYDIRECT;
- return (1);
- }
-diff -ru tiff-3.8.2/libtiff/tif_jpeg.c tiff-3.8.2-goo/libtiff/tif_jpeg.c
---- tiff-3.8.2/libtiff/tif_jpeg.c 2006-03-21 16:42:50.000000000 +0000
-+++ tiff-3.8.2-goo/libtiff/tif_jpeg.c 2006-07-14 13:52:00.655560000 +0100
-@@ -722,15 +722,31 @@
- segment_width = TIFFhowmany(segment_width, sp->h_sampling);
- segment_height = TIFFhowmany(segment_height, sp->v_sampling);
- }
-- if (sp->cinfo.d.image_width != segment_width ||
-- sp->cinfo.d.image_height != segment_height) {
-+ if (sp->cinfo.d.image_width < segment_width ||
-+ sp->cinfo.d.image_height < segment_height) {
- TIFFWarningExt(tif->tif_clientdata, module,
- "Improper JPEG strip/tile size, expected %dx%d, got %dx%d",
- segment_width,
- segment_height,
- sp->cinfo.d.image_width,
- sp->cinfo.d.image_height);
-+ }
-+
-+ if (sp->cinfo.d.image_width > segment_width ||
-+ sp->cinfo.d.image_height > segment_height) {
-+ /*
-+ * This case could be dangerous, if the strip or tile size has been
-+ * reported as less than the amount of data jpeg will return, some
-+ * potential security issues arise. Catch this case and error out.
-+ * -- taviso@google.com 14 Jun 2006
-+ */
-+ TIFFErrorExt(tif->tif_clientdata, module,
-+ "JPEG strip/tile size exceeds expected dimensions,"
-+ "expected %dx%d, got %dx%d", segment_width, segment_height,
-+ sp->cinfo.d.image_width, sp->cinfo.d.image_height);
-+ return (0);
- }
-+
- if (sp->cinfo.d.num_components !=
- (td->td_planarconfig == PLANARCONFIG_CONTIG ?
- td->td_samplesperpixel : 1)) {
-@@ -761,6 +777,22 @@
- sp->cinfo.d.comp_info[0].v_samp_factor,
- sp->h_sampling, sp->v_sampling);
-
-+ /*
-+ * There are potential security issues here for decoders that
-+ * have already allocated buffers based on the expected sampling
-+ * factors. Lets check the sampling factors dont exceed what
-+ * we were expecting.
-+ * -- taviso@google.com 14 June 2006
-+ */
-+ if (sp->cinfo.d.comp_info[0].h_samp_factor > sp->h_sampling ||
-+ sp->cinfo.d.comp_info[0].v_samp_factor > sp->v_sampling) {
-+ TIFFErrorExt(tif->tif_clientdata, module,
-+ "Cannot honour JPEG sampling factors that"
-+ " exceed those specified.");
-+ return (0);
-+ }
-+
-+
- /*
- * XXX: Files written by the Intergraph software
- * has different sampling factors stored in the
-@@ -1521,15 +1553,18 @@
- {
- JPEGState *sp = JState(tif);
-
-- assert(sp != 0);
-+ /* assert(sp != 0); */
-
- tif->tif_tagmethods.vgetfield = sp->vgetparent;
- tif->tif_tagmethods.vsetfield = sp->vsetparent;
-
-- if( sp->cinfo_initialized )
-- TIFFjpeg_destroy(sp); /* release libjpeg resources */
-- if (sp->jpegtables) /* tag value */
-- _TIFFfree(sp->jpegtables);
-+ if (sp != NULL) {
-+ if( sp->cinfo_initialized )
-+ TIFFjpeg_destroy(sp); /* release libjpeg resources */
-+ if (sp->jpegtables) /* tag value */
-+ _TIFFfree(sp->jpegtables);
-+ }
-+
- _TIFFfree(tif->tif_data); /* release local state */
- tif->tif_data = NULL;
-
-@@ -1541,6 +1576,7 @@
- {
- JPEGState* sp = JState(tif);
- TIFFDirectory* td = &tif->tif_dir;
-+ const TIFFFieldInfo* fip;
- uint32 v32;
-
- assert(sp != NULL);
-@@ -1606,7 +1642,13 @@
- default:
- return (*sp->vsetparent)(tif, tag, ap);
- }
-- TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
-+
-+ if ((fip = _TIFFFieldWithTag(tif, tag))) {
-+ TIFFSetFieldBit(tif, fip->field_bit);
-+ } else {
-+ return (0);
-+ }
-+
- tif->tif_flags |= TIFF_DIRTYDIRECT;
- return (1);
- }
-@@ -1726,7 +1768,11 @@
- {
- JPEGState* sp = JState(tif);
-
-- assert(sp != NULL);
-+ /* assert(sp != NULL); */
-+ if (sp == NULL) {
-+ TIFFWarningExt(tif->tif_clientdata, "JPEGPrintDir", "Unknown JPEGState");
-+ return;
-+ }
-
- (void) flags;
- if (TIFFFieldSet(tif,FIELD_JPEGTABLES))
-diff -ru tiff-3.8.2/libtiff/tif_next.c tiff-3.8.2-goo/libtiff/tif_next.c
---- tiff-3.8.2/libtiff/tif_next.c 2005-12-21 12:33:56.000000000 +0000
-+++ tiff-3.8.2-goo/libtiff/tif_next.c 2006-07-14 13:52:00.556567000 +0100
-@@ -105,11 +105,16 @@
- * as codes of the form <color><npixels>
- * until we've filled the scanline.
- */
-+ /*
-+ * Ensure the run does not exceed the scanline
-+ * bounds, potentially resulting in a security issue.
-+ * -- taviso@google.com 14 Jun 2006.
-+ */
- op = row;
- for (;;) {
- grey = (n>>6) & 0x3;
- n &= 0x3f;
-- while (n-- > 0)
-+ while (n-- > 0 && npixels < imagewidth)
- SETPIXEL(op, grey);
- if (npixels >= (int) imagewidth)
- break;
-diff -ru tiff-3.8.2/libtiff/tif_pixarlog.c tiff-3.8.2-goo/libtiff/tif_pixarlog.c
---- tiff-3.8.2/libtiff/tif_pixarlog.c 2006-03-21 16:42:50.000000000 +0000
-+++ tiff-3.8.2-goo/libtiff/tif_pixarlog.c 2006-07-14 13:52:00.483557000 +0100
-@@ -768,7 +768,19 @@
- if (tif->tif_flags & TIFF_SWAB)
- TIFFSwabArrayOfShort(up, nsamples);
-
-- for (i = 0; i < nsamples; i += llen, up += llen) {
-+ /*
-+ * if llen is not an exact multiple of nsamples, the decode operation
-+ * may overflow the output buffer, so truncate it enough to prevent that
-+ * but still salvage as much data as possible.
-+ * -- taviso@google.com 14th June 2006
-+ */
-+ if (nsamples % llen)
-+ TIFFWarningExt(tif->tif_clientdata, module,
-+ "%s: stride %lu is not a multiple of sample count, "
-+ "%lu, data truncated.", tif->tif_name, llen, nsamples);
-+
-+
-+ for (i = 0; i < nsamples - (nsamples % llen); i += llen, up += llen) {
- switch (sp->user_datafmt) {
- case PIXARLOGDATAFMT_FLOAT:
- horizontalAccumulateF(up, llen, sp->stride,
-diff -ru tiff-3.8.2/libtiff/tif_read.c tiff-3.8.2-goo/libtiff/tif_read.c
---- tiff-3.8.2/libtiff/tif_read.c 2005-12-21 12:33:56.000000000 +0000
-+++ tiff-3.8.2-goo/libtiff/tif_read.c 2006-07-14 13:52:00.467568000 +0100
-@@ -31,6 +31,8 @@
- #include "tiffiop.h"
- #include <stdio.h>
-
-+#include <limits.h>
-+
- int TIFFFillStrip(TIFF*, tstrip_t);
- int TIFFFillTile(TIFF*, ttile_t);
- static int TIFFStartStrip(TIFF*, tstrip_t);
-@@ -272,7 +274,13 @@
- if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)
- _TIFFfree(tif->tif_rawdata);
- tif->tif_flags &= ~TIFF_MYBUFFER;
-- if ( td->td_stripoffset[strip] + bytecount > tif->tif_size) {
-+ /*
-+ * This sanity check could potentially overflow, causing an OOB read.
-+ * verify that offset + bytecount is > offset.
-+ * -- taviso@google.com 14 Jun 2006
-+ */
-+ if ( td->td_stripoffset[strip] + bytecount > tif->tif_size ||
-+ bytecount > (UINT_MAX - td->td_stripoffset[strip])) {
- /*
- * This error message might seem strange, but it's
- * what would happen if a read were done instead.
-@@ -470,7 +478,13 @@
- if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)
- _TIFFfree(tif->tif_rawdata);
- tif->tif_flags &= ~TIFF_MYBUFFER;
-- if ( td->td_stripoffset[tile] + bytecount > tif->tif_size) {
-+ /*
-+ * We must check this calculation doesnt overflow, potentially
-+ * causing an OOB read.
-+ * -- taviso@google.com 15 Jun 2006
-+ */
-+ if (td->td_stripoffset[tile] + bytecount > tif->tif_size ||
-+ bytecount > (UINT_MAX - td->td_stripoffset[tile])) {
- tif->tif_curtile = NOTILE;
- return (0);
- }
diff --git a/media-libs/tiff/files/tiff-3.8.2-tiffsplit.patch b/media-libs/tiff/files/tiff-3.8.2-tiffsplit.patch
deleted file mode 100644
index 5422e74..0000000
--- a/media-libs/tiff/files/tiff-3.8.2-tiffsplit.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-diff -ruN tiff-3.7.4-old/tools/tiffsplit.c tiff-3.7.4/tools/tiffsplit.c
---- tiff-3.7.4-old/tools/tiffsplit.c 2005-05-26 20:38:48.000000000 +0200
-+++ tiff-3.7.4/tools/tiffsplit.c 2006-06-01 16:00:11.000000000 +0200
-@@ -60,14 +60,13 @@
- return (-3);
- }
- if (argc > 2)
-- strcpy(fname, argv[2]);
-+ snprintf(fname, sizeof(fname), "%s", argv[2]);
- in = TIFFOpen(argv[1], "r");
- if (in != NULL) {
- do {
- char path[1024+1];
- newfilename();
-- strcpy(path, fname);
-- strcat(path, ".tif");
-+ snprintf(path, sizeof(path), "%s.tif", fname);
- out = TIFFOpen(path, TIFFIsBigEndian(in)?"wb":"wl");
- if (out == NULL)
- return (-2);
diff --git a/media-libs/tiff/files/tiff-buffer.patch b/media-libs/tiff/files/tiff-buffer.patch
deleted file mode 100644
index b5ff2ee..0000000
--- a/media-libs/tiff/files/tiff-buffer.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- tools/tiff2pdf.c.orig 2006-06-04 18:26:40.000000000 -0700
-+++ tools/tiff2pdf.c 2006-06-04 18:27:22.000000000 -0700
-@@ -3668,7 +3668,7 @@
- written += TIFFWriteFile(output, (tdata_t) "(", 1);
- for (i=0;i<len;i++){
- if((pdfstr[i]&0x80) || (pdfstr[i]==127) || (pdfstr[i]<32)){
-- sprintf(buffer, "\\%.3o", pdfstr[i]);
-+ snprintf(buffer, "\\%.3o", pdfstr[i]);
- written += TIFFWriteFile(output, (tdata_t) buffer, 4);
- } else {
- switch (pdfstr[i]){
diff --git a/media-libs/tiff/files/tiff-jbig.patch b/media-libs/tiff/files/tiff-jbig.patch
deleted file mode 100644
index 58d079d..0000000
--- a/media-libs/tiff/files/tiff-jbig.patch
+++ /dev/null
@@ -1,510 +0,0 @@
---- configure.orig 2005-09-12 06:52:41.000000000 -0700
-+++ configure 2006-06-06 19:41:22.000000000 -0700
-@@ -23648,6 +23648,25 @@
- fi
-
-
-+HAVE_JBIG=no
-+# Check whether --enable-jbig or --disable-jbig was given.
-+if test "${enable_jbig+set}" = set; then
-+ enableval="$enable_jbig"
-+ HAVE_JBIG=$enableval
-+else
-+ HAVE_JBIG=no
-+fi;
-+
-+if test "$HAVE_JBIG" = "yes" ; then
-+
-+cat >>confdefs.h <<\_ACEOF
-+#define JBIG_SUPPORT 1
-+_ACEOF
-+
-+ LIBS="-ljbig $LIBS"
-+fi
-+
-+
- # Check whether --enable-cxx or --disable-cxx was given.
- if test "${enable_cxx+set}" = set; then
- enableval="$enable_cxx"
-@@ -27680,6 +27699,7 @@
- echo " Pixar log-format algorithm: ${HAVE_PIXARLOG}"
- echo " JPEG support: ${HAVE_JPEG}"
- echo " Old JPEG support: ${HAVE_OJPEG}"
-+echo " JBIG support: ${HAVE_JBIG}"
- echo ""
- echo " C++ support: ${HAVE_CXX}"
- echo ""
---- configure.ac.orig 2005-09-12 06:52:41.000000000 -0700
-+++ configure.ac 2006-06-06 19:35:23.000000000 -0700
-@@ -387,6 +387,22 @@
- fi
-
- dnl ---------------------------------------------------------------------------
-+dnl Check for JBIG.
-+dnl ---------------------------------------------------------------------------
-+
-+HAVE_JBIG=no
-+AC_ARG_ENABLE(jbig,
-+ AS_HELP_STRING([--disable-jbig],
-+ [disable support for JBIG]),
-+ [HAVE_JBIG=$enableval], [HAVE_JBIG=no])
-+
-+if test "$HAVE_JBIG" = "yes" ; then
-+ AC_DEFINE(JBIG_SUPPORT, 1,
-+ [Support JBIG])
-+ LIBS="-ljbig $LIBS"
-+fi
-+
-+dnl ---------------------------------------------------------------------------
- dnl Check for C++.
- dnl ---------------------------------------------------------------------------
-
---- libtiff/Makefile.in.orig 2005-09-12 09:33:05.000000000 -0700
-+++ libtiff/Makefile.in 2006-06-06 19:35:23.000000000 -0700
-@@ -97,7 +97,7 @@
- tif_compress.lo tif_dir.lo tif_dirinfo.lo tif_dirread.lo \
- tif_dirwrite.lo tif_dumpmode.lo tif_error.lo tif_extension.lo \
- tif_fax3.lo tif_fax3sm.lo tif_flush.lo tif_getimage.lo \
-- tif_jpeg.lo tif_luv.lo tif_lzw.lo tif_next.lo tif_ojpeg.lo \
-+ tif_jpeg.lo tif_jbig.lo tif_luv.lo tif_lzw.lo tif_next.lo tif_ojpeg.lo \
- tif_open.lo tif_packbits.lo tif_pixarlog.lo tif_predict.lo \
- tif_print.lo tif_read.lo tif_strip.lo tif_swab.lo \
- tif_thunder.lo tif_tile.lo tif_unix.lo tif_version.lo \
-@@ -306,6 +306,7 @@
- tif_flush.c \
- tif_getimage.c \
- tif_jpeg.c \
-+ tif_jbig.c \
- tif_luv.c \
- tif_lzw.c \
- tif_next.c \
-@@ -480,6 +481,7 @@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_flush.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_getimage.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_jpeg.Plo@am__quote@
-+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_jbig.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_luv.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_lzw.Plo@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tif_next.Plo@am__quote@
---- libtiff/tif_config.h.in.orig 2005-07-12 09:02:04.000000000 -0700
-+++ libtiff/tif_config.h.in 2006-06-06 19:35:23.000000000 -0700
-@@ -146,6 +146,9 @@
- /* Support JPEG compression (requires IJG JPEG library) */
- #undef JPEG_SUPPORT
-
-+/* Support JBIG compression (requires JBIG-KIT library) */
-+#undef JBIG_SUPPORT
-+
- /* Support LogLuv high dynamic range encoding */
- #undef LOGLUV_SUPPORT
-
---- libtiff/tif_jbig.c.orig 2006-06-06 19:32:40.000000000 -0700
-+++ libtiff/tif_jbig.c 2006-06-06 19:35:23.000000000 -0700
-@@ -0,0 +1,340 @@
-+/*
-+ * Copyright (c) 1988-1997 Sam Leffler
-+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
-+ *
-+ * Permission to use, copy, modify, distribute, and sell this software and
-+ * its documentation for any purpose is hereby granted without fee, provided
-+ * that (i) the above copyright notices and this permission notice appear in
-+ * all copies of the software and related documentation, and (ii) the names of
-+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
-+ * publicity relating to the software without the specific, prior written
-+ * permission of Sam Leffler and Silicon Graphics.
-+ *
-+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
-+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
-+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-+ *
-+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
-+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
-+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
-+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
-+ * OF THIS SOFTWARE.
-+ */
-+
-+/*
-+ * TIFF Library.
-+ *
-+ * JBIG Compression Algorithm Support.
-+ */
-+
-+#include "tiffio.h"
-+#include "tiffiop.h"
-+
-+#ifdef JBIG_SUPPORT
-+#include "jbig.h"
-+
-+struct JBIGState
-+{
-+ uint32 recvparams; /* encoded Class 2 session params */
-+ char* subaddress; /* subaddress string */
-+ uint32 recvtime; /* time spend receiving in seconds */
-+ char* faxdcs; /* encoded fax parameters (DCS, Table 2/T.30) */
-+
-+ TIFFVGetMethod vgetparent;
-+ TIFFVSetMethod vsetparent;
-+};
-+
-+#define GetJBIGState(tif) ((struct JBIGState*)(tif)->tif_data)
-+#define N(a) (sizeof (a) / sizeof (a[0]))
-+
-+#define FIELD_RECVPARAMS (FIELD_CODEC+0)
-+#define FIELD_SUBADDRESS (FIELD_CODEC+1)
-+#define FIELD_RECVTIME (FIELD_CODEC+2)
-+#define FIELD_FAXDCS (FIELD_CODEC+3)
-+
-+static const TIFFFieldInfo jbigFieldInfo[] =
-+{
-+ {TIFFTAG_FAXRECVPARAMS, 1, 1, TIFF_LONG, FIELD_RECVPARAMS, TRUE, FALSE, "FaxRecvParams"},
-+ {TIFFTAG_FAXSUBADDRESS, -1, -1, TIFF_ASCII, FIELD_SUBADDRESS, TRUE, FALSE, "FaxSubAddress"},
-+ {TIFFTAG_FAXRECVTIME, 1, 1, TIFF_LONG, FIELD_RECVTIME, TRUE, FALSE, "FaxRecvTime"},
-+ {TIFFTAG_FAXDCS, -1, -1, TIFF_ASCII, FIELD_FAXDCS, TRUE, FALSE, "FaxDcs"},
-+};
-+
-+static int JBIGSetupDecode(TIFF* tif)
-+{
-+ if (TIFFNumberOfStrips(tif) != 1)
-+ {
-+ TIFFError("JBIG", "Multistrip images not supported in decoder");
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+static int JBIGDecode(TIFF* tif, tidata_t buffer, tsize_t size, tsample_t s)
-+{
-+ struct jbg_dec_state decoder;
-+ int decodeStatus = 0;
-+ unsigned char* pImage = NULL;
-+
-+ if (isFillOrder(tif, tif->tif_dir.td_fillorder))
-+ {
-+ TIFFReverseBits(tif->tif_rawdata, tif->tif_rawdatasize);
-+ }
-+
-+ jbg_dec_init(&decoder);
-+ jbg_newlen(tif->tif_rawdata, tif->tif_rawdatasize);
-+ /*
-+ * I do not check the return status of jbg_newlen because even if this function
-+ * fails it does not necessarily mean that decoding the image will fail. It is
-+ * generally only needed for received fax images that do not contain the actual
-+ * length of the image in the BIE header. I do not log when an error occurs
-+ * because that will cause problems when converting JBIG encoded TIFF's to
-+ * PostScript. As long as the actual image length is contained in the BIE header
-+ * jbg_dec_in should succeed.
-+ */
-+
-+ decodeStatus = jbg_dec_in(&decoder, tif->tif_rawdata, tif->tif_rawdatasize, NULL);
-+ if (JBG_EOK != decodeStatus)
-+ {
-+ TIFFError("JBIG", "Error (%d) decoding: %s", decodeStatus, jbg_strerror(decodeStatus, JBG_EN));
-+ return 0;
-+ }
-+
-+ pImage = jbg_dec_getimage(&decoder, 0);
-+ _TIFFmemcpy(buffer, pImage, jbg_dec_getsize(&decoder));
-+ jbg_dec_free(&decoder);
-+ return 1;
-+}
-+
-+static int JBIGSetupEncode(TIFF* tif)
-+{
-+ TIFFDirectory* dir = &tif->tif_dir;
-+
-+ if (TIFFNumberOfStrips(tif) != 1)
-+ {
-+ TIFFError("JBIG", "Multistrip images not supported in encoder");
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+static int JBIGCopyEncodedData(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
-+{
-+ (void) s;
-+ while (cc > 0)
-+ {
-+ tsize_t n = cc;
-+
-+ if (tif->tif_rawcc + n > tif->tif_rawdatasize)
-+ {
-+ n = tif->tif_rawdatasize - tif->tif_rawcc;
-+ }
-+
-+ assert(n > 0);
-+ _TIFFmemcpy(tif->tif_rawcp, pp, n);
-+ tif->tif_rawcp += n;
-+ tif->tif_rawcc += n;
-+ pp += n;
-+ cc -= n;
-+ if (tif->tif_rawcc >= tif->tif_rawdatasize &&
-+ !TIFFFlushData1(tif))
-+ {
-+ return (-1);
-+ }
-+ }
-+
-+ return (1);
-+}
-+
-+static void JBIGOutputBie(unsigned char* buffer, size_t len, void *userData)
-+{
-+ TIFF* tif = (TIFF*)userData;
-+
-+ if (isFillOrder(tif, tif->tif_dir.td_fillorder))
-+ {
-+ TIFFReverseBits(buffer, len);
-+ }
-+
-+ JBIGCopyEncodedData(tif, buffer, len, 0);
-+}
-+
-+static int JBIGEncode(TIFF* tif, tidata_t buffer, tsize_t size, tsample_t s)
-+{
-+ TIFFDirectory* dir = &tif->tif_dir;
-+ struct jbg_enc_state encoder;
-+
-+ jbg_enc_init(&encoder,
-+ dir->td_imagewidth,
-+ dir->td_imagelength,
-+ 1,
-+ &buffer,
-+ JBIGOutputBie,
-+ tif);
-+ /*
-+ * jbg_enc_out does the "real" encoding. As data is encoded, JBIGOutputBie
-+ * is called, which writes the data to the directory.
-+ */
-+ jbg_enc_out(&encoder);
-+ jbg_enc_free(&encoder);
-+
-+ return 1;
-+}
-+
-+static void JBIGCleanup(TIFF* tif)
-+{
-+ if (NULL != tif->tif_data)
-+ {
-+ _TIFFfree(tif->tif_data);
-+ tif->tif_data = NULL;
-+ }
-+}
-+
-+static void JBIGPrintDir(TIFF* tif, FILE* fd, long flags)
-+{
-+ struct JBIGState* codec = GetJBIGState(tif);
-+ (void)flags;
-+
-+ if (TIFFFieldSet(tif, FIELD_RECVPARAMS))
-+ {
-+ fprintf(fd,
-+ " Fax Receive Parameters: %08lx\n",
-+ (unsigned long)codec->recvparams);
-+ }
-+
-+ if (TIFFFieldSet(tif, FIELD_SUBADDRESS))
-+ {
-+ fprintf(fd,
-+ " Fax SubAddress: %s\n",
-+ codec->subaddress);
-+ }
-+
-+ if (TIFFFieldSet(tif, FIELD_RECVTIME))
-+ {
-+ fprintf(fd,
-+ " Fax Receive Time: %lu secs\n",
-+ (unsigned long)codec->recvtime);
-+ }
-+
-+ if (TIFFFieldSet(tif, FIELD_FAXDCS))
-+ {
-+ fprintf(fd,
-+ " Fax DCS: %s\n",
-+ codec->faxdcs);
-+ }
-+}
-+
-+static int JBIGVGetField(TIFF* tif, ttag_t tag, va_list ap)
-+{
-+ struct JBIGState* codec = GetJBIGState(tif);
-+
-+ switch (tag)
-+ {
-+ case TIFFTAG_FAXRECVPARAMS:
-+ *va_arg(ap, uint32*) = codec->recvparams;
-+ break;
-+
-+ case TIFFTAG_FAXSUBADDRESS:
-+ *va_arg(ap, char**) = codec->subaddress;
-+ break;
-+
-+ case TIFFTAG_FAXRECVTIME:
-+ *va_arg(ap, uint32*) = codec->recvtime;
-+ break;
-+
-+ case TIFFTAG_FAXDCS:
-+ *va_arg(ap, char**) = codec->faxdcs;
-+ break;
-+
-+ default:
-+ return (*codec->vgetparent)(tif, tag, ap);
-+ }
-+
-+ return 1;
-+}
-+
-+static int JBIGVSetField(TIFF* tif, ttag_t tag, va_list ap)
-+{
-+ struct JBIGState* codec = GetJBIGState(tif);
-+
-+ switch (tag)
-+ {
-+ case TIFFTAG_FAXRECVPARAMS:
-+ codec->recvparams = va_arg(ap, uint32);
-+ break;
-+
-+ case TIFFTAG_FAXSUBADDRESS:
-+ _TIFFsetString(&codec->subaddress, va_arg(ap, char*));
-+ break;
-+
-+ case TIFFTAG_FAXRECVTIME:
-+ codec->recvtime = va_arg(ap, uint32);
-+ break;
-+
-+ case TIFFTAG_FAXDCS:
-+ _TIFFsetString(&codec->faxdcs, va_arg(ap, char*));
-+ break;
-+
-+ default:
-+ return (*codec->vsetparent)(tif, tag, ap);
-+ }
-+
-+ TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
-+ tif->tif_flags |= TIFF_DIRTYDIRECT;
-+ return 1;
-+}
-+
-+int TIFFInitJBIG(TIFF* tif, int scheme)
-+{
-+ struct JBIGState* codec = NULL;
-+
-+ /* Allocate memory for the JBIGState structure.*/
-+ tif->tif_data = (tdata_t)_TIFFmalloc(sizeof(struct JBIGState));
-+ if (tif->tif_data == NULL)
-+ {
-+ TIFFError("TIFFInitJBIG", "Not enough memory for JBIGState");
-+ return 0;
-+ }
-+ _TIFFmemset(tif->tif_data, 0, sizeof(struct JBIGState));
-+ codec = GetJBIGState(tif);
-+
-+ /* Initialize codec private fields */
-+ codec->recvparams = 0;
-+ codec->subaddress = NULL;
-+ codec->faxdcs = NULL;
-+ codec->recvtime = 0;
-+
-+ /* Register codec private fields with libtiff and setup function pointers*/
-+ _TIFFMergeFieldInfo(tif, jbigFieldInfo, N(jbigFieldInfo));
-+
-+ codec->vgetparent = tif->tif_tagmethods.vgetfield;
-+ codec->vsetparent = tif->tif_tagmethods.vsetfield;
-+
-+ tif->tif_tagmethods.vgetfield = JBIGVGetField;
-+ tif->tif_tagmethods.vsetfield = JBIGVSetField;
-+ tif->tif_tagmethods.printdir = JBIGPrintDir;
-+
-+
-+ /*
-+ * These flags are set so the JBIG Codec can control when to reverse bits and when
-+ * not to and to allow the jbig decoder and bit reverser to write to memory
-+ * when necessary.
-+ */
-+ tif->tif_flags |= TIFF_NOBITREV;
-+ tif->tif_flags &= ~TIFF_MAPPED;
-+
-+ /* Setup the function pointers for encode, decode, and cleanup. */
-+ tif->tif_setupdecode = JBIGSetupDecode;
-+ tif->tif_decodestrip = JBIGDecode;
-+
-+ tif->tif_setupencode = JBIGSetupEncode;
-+ tif->tif_encodestrip = JBIGEncode;
-+
-+ tif->tif_cleanup = JBIGCleanup;
-+
-+ return 1;
-+}
-+
-+#endif /* JBIG_SUPPORT */
---- libtiff/tiffconf.h.in.orig 2005-07-28 01:49:24.000000000 -0700
-+++ libtiff/tiffconf.h.in 2006-06-06 19:35:23.000000000 -0700
-@@ -40,6 +40,9 @@
- /* Support JPEG compression (requires IJG JPEG library) */
- #undef JPEG_SUPPORT
-
-+/* Support JBIG compression (requires JBIG-KIT library) */
-+#undef JBIG_SUPPORT
-+
- /* Support LogLuv high dynamic range encoding */
- #undef LOGLUV_SUPPORT
-
---- libtiff/tiffconf.h.vc.orig 2005-07-28 01:49:24.000000000 -0700
-+++ libtiff/tiffconf.h.vc 2006-06-06 19:35:23.000000000 -0700
-@@ -41,6 +41,9 @@
- /* Support JPEG compression (requires IJG JPEG library) */
- /* #undef JPEG_SUPPORT */
-
-+/* Support JBIG compression (requires JBIG-KIT library) */
-+#undef JBIG_SUPPORT
-+
- /* Support LogLuv high dynamic range encoding */
- #define LOGLUV_SUPPORT 1
-
---- tools/tiffcp.c.orig 2005-07-08 02:03:49.000000000 -0700
-+++ tools/tiffcp.c 2006-06-06 19:44:44.000000000 -0700
-@@ -349,6 +349,8 @@
- if (cp)
- defpredictor = atoi(cp+1);
- defcompression = COMPRESSION_ADOBE_DEFLATE;
-+ } else if (strneq(opt, "jbig", 4)) {
-+ defcompression = COMPRESSION_JBIG;
- } else
- return (0);
- return (1);
-@@ -648,6 +650,12 @@
- TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
- TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
- break;
-+ case COMPRESSION_JBIG:
-+ CopyTag(TIFFTAG_FAXRECVPARAMS, 1, TIFF_LONG);
-+ CopyTag(TIFFTAG_FAXRECVTIME, 1, TIFF_LONG);
-+ CopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);
-+ CopyTag(TIFFTAG_FAXDCS, 1, TIFF_ASCII);
-+ break;
- case COMPRESSION_LZW:
- case COMPRESSION_ADOBE_DEFLATE:
- case COMPRESSION_DEFLATE:
---- libtiff/Makefile.vc.orig 2006-06-06 19:58:40.000000000 -0700
-+++ libtiff/Makefile.vc 2006-06-06 19:59:32.000000000 -0700
-@@ -29,7 +29,7 @@
-
- !INCLUDE ..\nmake.opt
-
--INCL = -I. $(JPEG_INCLUDE) $(ZLIB_INCLUDE)
-+INCL = -I. $(JPEG_INCLUDE) $(ZLIB_INCLUDE) $(JBIG_INCLUDE)
-
- !IFDEF USE_WIN_CRT_LIB
- OBJ_SYSDEP_MODULE = tif_unix.obj
-@@ -74,6 +74,7 @@
- tif_warning.obj \
- tif_write.obj \
- tif_zip.obj \
-+ tif_jbig.obj \
- $(OBJ_SYSDEP_MODULE)
-
- all: libtiff.lib $(DLLNAME)
diff --git a/media-libs/tiff/tiff-3.8.2-r3.ebuild b/media-libs/tiff/tiff-3.8.2-r3.ebuild
deleted file mode 100644
index b3fac53..0000000
--- a/media-libs/tiff/tiff-3.8.2-r3.ebuild
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-libs/tiff/tiff-3.8.2-r2.ebuild,v 1.3 2006/09/01 12:49:03 exg Exp $
-
-inherit eutils libtool
-
-DESCRIPTION="Library for manipulation of TIFF (Tag Image File Format) images"
-HOMEPAGE="http://www.libtiff.org/"
-SRC_URI="ftp://ftp.remotesensing.org/pub/libtiff/${P}.tar.gz
- mirror://gentoo/${P}-tiff2pdf.patch.bz2"
-
-LICENSE="as-is"
-SLOT="0"
-KEYWORDS=""
-IUSE="jpeg jbig nocxx zlib"
-
-DEPEND="jpeg? ( >=media-libs/jpeg-6b )
- jbig? ( >=media-libs/jbigkit-1.6-r1 )
- zlib? ( >=sys-libs/zlib-1.1.3-r2 )"
-
-src_unpack() {
- unpack ${A}
- cd "${S}"
- epatch ${WORKDIR}/${P}-tiff2pdf.patch || die "epatch tiff2pdf failed"
- epatch ${FILESDIR}/${P}-tiffsplit.patch || die "epatch tiffsplit failed"
- if use jbig; then
- epatch "${FILESDIR}"/${PN}-jbig.patch || die "epatch jbig failed"
- fi
- epatch ${FILESDIR}/${P}-goo-sec.patch || die "epatch goo-sec failed"
- elibtoolize
-}
-
-src_compile() {
- econf \
- $(use_enable !nocxx cxx) \
- $(use_enable zlib) \
- $(use_enable jpeg) \
- $(use_enable jpeg old-jpeg) \
- $(use_enable jbig) \
- --with-pic --without-x \
- || die "econf failed"
- emake || die "emake failed"
-}
-
-src_install() {
- make install DESTDIR="${D}" || die "make install failed"
- dodoc README TODO VERSION
-}
-
-pkg_postinst() {
- echo
- einfo "JBIG support is intended for Hylafax fax compression, so we"
- einfo "really need more feedback in other areas (most testing has"
- einfo "been done with fax). Be sure to recompile anything linked"
- einfo "against tiff if you rebuild it with jbig support."
- echo
-}