summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfwarmerdam <fwarmerdam>2012-05-24 01:40:24 +0000
committerfwarmerdam <fwarmerdam>2012-05-24 01:40:24 +0000
commit88796dafa881d683323f2461656adfc85eb22fb5 (patch)
tree1317ff25751654a5f2878d83630b8ff0bdb81b9a
parent03db4cee9b536d5c3bb0e212b58707ff2f5b4f41 (diff)
downloadlibtiff-88796dafa881d683323f2461656adfc85eb22fb5.tar.gz
fix crash with odd 16bit count types for some custom fields
-rw-r--r--ChangeLog3
-rw-r--r--libtiff/tif_print.c15
2 files changed, 16 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e26395e7..c3e941ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2012-05-23 Frank Warmerdam <warmerdam@google.com>
+ * libtiff/tif_print.c: Avoid confusion about count size when printing custom fields.
+ May affect things like ISOSpeedRatings.
+
* libtiff/tif_dir.c: avoid one byte past end of ink names reading
in some cases.
diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c
index 9481eb62..b80358c1 100644
--- a/libtiff/tif_print.c
+++ b/libtiff/tif_print.c
@@ -1,4 +1,4 @@
-/* $Id: tif_print.c,v 1.54 2011-04-02 20:54:09 bfriesen Exp $ */
+/* $Id: tif_print.c,v 1.55 2012-05-24 01:40:25 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -548,8 +548,19 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
continue;
if(fip->field_passcount) {
- if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1)
+ if (fip->field_readcount == TIFF_VARIABLE2 ) {
+ if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1)
+ continue;
+ } else if (fip->field_readcount == TIFF_VARIABLE2 ) {
+ uint16 small_value_count;
+ if(TIFFGetField(tif, tag, &small_value_count, &raw_data) != 1)
+ continue;
+ value_count = small_value_count;
+ } else {
+ assert (fip->field_readcount == TIFF_VARIABLE
+ || fip->field_readcount == TIFF_VARIABLE2);
continue;
+ }
} else {
if (fip->field_readcount == TIFF_VARIABLE
|| fip->field_readcount == TIFF_VARIABLE2)