libtiff: ensure tile and strip sizes are reset when loading new directory (#1936)

https://github.com/libsdl-org/libtiff/commit/f132add071bc50223a4b0b31fd18ddce53eeae1f

From f132add071bc50223a4b0b31fd18ddce53eeae1f Mon Sep 17 00:00:00 2001
From: Frank Warmerdam <[EMAIL REDACTED]>
Date: Thu, 7 Jan 2010 04:05:38 +0000
Subject: [PATCH] ensure tile and strip sizes are reset when loading new
 directory (#1936)

---
 ChangeLog         | 6 ++++++
 libtiff/tif_dir.c | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index bb251ef1..617e6f27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-06  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_dir.c: Ensure tile and scanline sizes are reset
+	when moving to new directories. 
+	http://bugzilla.maptools.org/show_bug.cgi?id=1936
+
 2009-12-03  Frank Warmerdam  <warmerdam@pobox.com>
 
 	* libtiff/tif_jpeg.c: Fix a couple of issues that trigger failures in
diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c
index 102c9a85..27e91f74 100644
--- a/libtiff/tif_dir.c
+++ b/libtiff/tif_dir.c
@@ -1,4 +1,4 @@
-/* $Id: tif_dir.c,v 1.75.2.2 2009-01-01 00:10:43 bfriesen Exp $ */
+/* $Id: tif_dir.c,v 1.75.2.3 2010-01-07 04:05:39 fwarmerdam Exp $ */
 
 /*
  * Copyright (c) 1988-1997 Sam Leffler
@@ -1099,6 +1099,11 @@ TIFFDefaultDirectory(TIFF* tif)
 	 * Should we also be clearing stuff like INSUBIFD?
 	 */
 	tif->tif_flags &= ~TIFF_ISTILED;
+        /*
+         * Clear other directory-specific fields.
+         */
+        tif->tif_tilesize = -1;
+        tif->tif_scanlinesize = -1;
 
 	return (1);
 }