summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortgl <tgl>2012-12-12 23:18:05 +0000
committertgl <tgl>2012-12-12 23:18:05 +0000
commit7404e78c5cd3150c9f803da533dc79ef33d5b1fe (patch)
tree46a04ba3aae3201233a1f8b8e717e24b35700675
parenteafda1e5f233c8e39e26d966d83532ba130b4abd (diff)
downloadlibtiff-7404e78c5cd3150c9f803da533dc79ef33d5b1fe.tar.gz
Back-patch recent fixes in TIFFPrintDirectory for field_passcount fields.
-rw-r--r--ChangeLog6
-rw-r--r--libtiff/tif_print.c15
2 files changed, 19 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6e2d47cf..8696d6ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-12 Tom Lane <tgl@sss.pgh.pa.us>
+
+ * libtiff/tif_print.c: Back-patch recent fixes in
+ TIFFPrintDirectory to make it handle field_passcount fields sanely
+ for both TIFF_VARIABLE and TIFF_VARIABLE2 cases.
+
2012-12-10 Tom Lane <tgl@sss.pgh.pa.us>
* tools/ppm2tiff.c: Back-patch fix for CVE-2012-4564.
diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c
index 7634f6e0..2b255da0 100644
--- a/libtiff/tif_print.c
+++ b/libtiff/tif_print.c
@@ -1,4 +1,4 @@
-/* $Id: tif_print.c,v 1.36.2.5 2010-07-06 14:05:30 dron Exp $ */
+/* $Id: tif_print.c,v 1.36.2.6 2012-12-12 23:18:05 tgl Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -514,8 +514,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_VARIABLE ) {
+ 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)