libtiff: * libtiff/tif_print.c (TIFFPrintDirectory): Applied patch for "tag

https://github.com/libsdl-org/libtiff/commit/374fe70ca9d7900e60968eb8cd1dfea0af597925

From 374fe70ca9d7900e60968eb8cd1dfea0af597925 Mon Sep 17 00:00:00 2001
From: Bob Friesenhahn <[EMAIL REDACTED]>
Date: Thu, 20 Aug 2009 20:31:33 +0000
Subject: [PATCH] * libtiff/tif_print.c (TIFFPrintDirectory): Applied patch for
 "tag error may cause segfault in tif_print.c."
 http://bugzilla.maptools.org/show_bug.cgi?id=1896

---
 ChangeLog           | 4 ++++
 libtiff/tif_print.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c2b77122..e6ab6597 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-08-20  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
 
+	* libtiff/tif_print.c (TIFFPrintDirectory): Applied patch for "tag
+	error may cause segfault in tif_print.c."
+	http://bugzilla.maptools.org/show_bug.cgi?id=1896
+
 	* tools/{rgb2ycbcr.c, tiff2rgba.c}: Applied patch for
 	CVE-2009-2347 libtiff: integer overflows in various inter-color
 	space conversion tools.
diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c
index dbb1d05e..4e98a7e5 100644
--- a/libtiff/tif_print.c
+++ b/libtiff/tif_print.c
@@ -1,4 +1,4 @@
-/* $Id: tif_print.c,v 1.36 2006-06-03 15:28:33 bfriesen Exp $ */
+/* $Id: tif_print.c,v 1.36.2.1 2009-08-20 20:31:33 bfriesen Exp $ */
 
 /*
  * Copyright (c) 1988-1997 Sam Leffler
@@ -491,7 +491,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
 		} else
 			fprintf(fd, "(present)\n");
 	}
-	if (TIFFFieldSet(tif, FIELD_SUBIFD)) {
+	if (TIFFFieldSet(tif, FIELD_SUBIFD) && (td->td_subifd)) {
 		fprintf(fd, "  SubIFD Offsets:");
 		for (i = 0; i < td->td_nsubifd; i++)
 			fprintf(fd, " %5lu", (long) td->td_subifd[i]);