---- tiff-4.0.0/libtiff/tif_dir.c.orig 2011-02-19 17:26:09.000000000 +0100
-+++ tiff-4.0.0/libtiff/tif_dir.c 2011-12-24 10:43:18.779372638 +0100
-@@ -153,6 +153,7 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va
- {
- static const char module[] = "_TIFFVSetField";
-
-+ const TIFFField* fip;
- TIFFDirectory* td = &tif->tif_dir;
- int status = 1;
- uint32 v32, i, v;
-@@ -660,17 +661,19 @@ end:
- va_end(ap);
- return (status);
- badvalue:
-+ fip = TIFFFieldWithTag(tif, tag);
- TIFFErrorExt(tif->tif_clientdata, module,
- "%s: Bad value %u for \"%s\" tag",
- tif->tif_name, v,
-- TIFFFieldWithTag(tif, tag)->field_name);
-+ fip ? fip->field_name : "Unknown");
- va_end(ap);
- return (0);
- badvalue32:
-+ fip = TIFFFieldWithTag(tif, tag);
- TIFFErrorExt(tif->tif_clientdata, module,
- "%s: Bad value %u for \"%s\" tag",
- tif->tif_name, v32,
-- TIFFFieldWithTag(tif, tag)->field_name);
-+ fip ? fip->field_name : "Unknown");
- va_end(ap);
- return (0);
- }
---- tiff-4.0.0/libtiff/tif_dirread.c.orig 2011-12-22 00:18:41.000000000 +0100
-+++ tiff-4.0.0/libtiff/tif_dirread.c 2011-12-24 10:39:34.932698478 +0100
-@@ -3897,6 +3897,7 @@ TIFFReadDirectory(TIFF* tif)
- * Attempt to deal with a missing StripByteCounts tag.
- */
- if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS)) {
-+ const TIFFField* fip = TIFFFieldWithTag(tif, TIFFTAG_STRIPBYTECOUNTS);
- /*
- * Some manufacturers violate the spec by not giving
- * the size of the strips. In this case, assume there
-@@ -3912,7 +3913,7 @@ TIFFReadDirectory(TIFF* tif)
- TIFFWarningExt(tif->tif_clientdata, module,
- "TIFF directory is missing required "
- "\"%s\" field, calculating from imagelength",
-- TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
-+ fip ? fip->field_name : "Unknown");
- if (EstimateStripByteCounts(tif, dir, dircount) < 0)
- goto bad;
- /*
-@@ -3940,6 +3941,7 @@ TIFFReadDirectory(TIFF* tif)
- && _TIFFFillStriles(tif)
- && tif->tif_dir.td_stripoffset[0] != 0
- && BYTECOUNTLOOKSBAD) {
-+ const TIFFField* 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
-@@ -3948,7 +3950,7 @@ TIFFReadDirectory(TIFF* tif)
- */
- TIFFWarningExt(tif->tif_clientdata, module,
- "Bogus \"%s\" field, ignoring and calculating from imagelength",
-- TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
-+ fip ? fip->field_name : "Unknown");
- if(EstimateStripByteCounts(tif, dir, dircount) < 0)
- goto bad;
-
-@@ -3959,6 +3961,7 @@ TIFFReadDirectory(TIFF* tif)
- && tif->tif_dir.td_stripbytecount[0] != tif->tif_dir.td_stripbytecount[1]
- && tif->tif_dir.td_stripbytecount[0] != 0
- && tif->tif_dir.td_stripbytecount[1] != 0 ) {
-+ const TIFFField* fip = TIFFFieldWithTag(tif, TIFFTAG_STRIPBYTECOUNTS);
- /*
- * XXX: Some vendors fill StripByteCount array with
- * absolutely wrong values (it can be equal to
-@@ -3971,7 +3974,7 @@ TIFFReadDirectory(TIFF* tif)
- */
- TIFFWarningExt(tif->tif_clientdata, module,
- "Wrong \"%s\" field, ignoring and calculating from imagelength",
-- TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
-+ fip ? fip->field_name : "Unknown");
- if (EstimateStripByteCounts(tif, dir, dircount) < 0)
- goto bad;
- #endif /* !defined(DEFER_STRILE_LOAD) */