From bf44739aea238b1680f7ae3db3c25cc3c3357eb2 Mon Sep 17 00:00:00 2001 From: Lee Howard Date: Wed, 15 Dec 2010 01:05:02 +0000 Subject: [PATCH] * libtiff/tif_dirread.c: tolerate some cases where FIELD_COLORMAP is missing http://bugzilla.maptools.org/show_bug.cgi?id=2189 --- ChangeLog | 6 ++++++ libtiff/tif_dirread.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0147cc94..3765cef1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-12-14 Lee Howard + + * libtiff/tif_dirread.c: tolerate some cases where + FIELD_COLORMAP is missing + http://bugzilla.maptools.org/show_bug.cgi?id=2189 + 2010-12-14 Lee Howard * libtiff/tif_read.c: change read_ahead to tmsize_t diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c index fba14a23..fc29da82 100644 --- a/libtiff/tif_dirread.c +++ b/libtiff/tif_dirread.c @@ -1,4 +1,4 @@ -/* $Id: tif_dirread.c,v 1.164 2010-12-14 03:03:24 faxguy Exp $ */ +/* $Id: tif_dirread.c,v 1.165 2010-12-15 01:05:02 faxguy Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -3845,8 +3845,14 @@ TIFFReadDirectory(TIFF* tif) */ if (tif->tif_dir.td_photometric == PHOTOMETRIC_PALETTE && !TIFFFieldSet(tif, FIELD_COLORMAP)) { - MissingRequired(tif, "Colormap"); - goto bad; + if ( tif->tif_dir.td_bitspersample>=8 && tif->tif_dir.td_samplesperpixel==3) + tif->tif_dir.td_photometric = PHOTOMETRIC_RGB; + else if (tif->tif_dir.td_bitspersample>=8) + tif->tif_dir.td_photometric = PHOTOMETRIC_MINISBLACK; + else { + MissingRequired(tif, "Colormap"); + goto bad; + } } /* * OJPEG hack: