libtiff: avoid printing c->name if it does not exist

From 73992ff387cc29f2dee5ef4d1291d24770555b4e Mon Sep 17 00:00:00 2001
From: Frank Warmerdam <[EMAIL REDACTED]>
Date: Thu, 18 Dec 2008 19:48:27 +0000
Subject: [PATCH] avoid printing c->name if it does not exist

---
 ChangeLog           | 11 +++++++++++
 libtiff/tif_codec.c |  9 ++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 976792dd..a2f8d6ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-12-18  Frank Warmerdam  <warmerdam@pobox.com>
+
+	* libtiff/tif_codec.c: Avoid printing c->name if it does not exist.
+
 2008-10-21  Andrey Kiselev  <dron@ak4719.spb.edu>
 
 	* libtiff/tif_jbig.c: Support the JBIG-KIT 2.0 (compatibility with
@@ -25,6 +29,13 @@
 
 2008-05-24  Frank Warmerdam  <warmerdam@pobox.com>
 
+	* tif_codec.c: Avoid NULL pointer dereferencing for exotic 
+	compression codec codes.
+
+	* tif_dirread.c: zero tif->tif_dir after freeing the directory
+	in TIFFReadCustomDirectory().  I don't exactly remember why this
+	was important. 
+
 	* tif_dirwrite.c: Fix potential memory leak writing large double
 	tags. 
 
diff --git a/libtiff/tif_codec.c b/libtiff/tif_codec.c
index 44f7f901..02fb839b 100644
--- a/libtiff/tif_codec.c
+++ b/libtiff/tif_codec.c
@@ -1,4 +1,4 @@
-/* $Id: tif_codec.c,v 1.10 2005-12-21 12:23:13 joris Exp $ */
+/* $Id: tif_codec.c,v 1.10.2.1 2008-12-18 19:50:41 fwarmerdam Exp $ */
 
 /*
  * Copyright (c) 1988-1997 Sam Leffler
@@ -102,9 +102,12 @@ static int
 _notConfigured(TIFF* tif)
 {
 	const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
-
+        char compression_code[20];
+        
+        sprintf( compression_code, "%d", tif->tif_dir.td_compression );
 	TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
-	    "%s compression support is not configured", c->name);
+                     "%s compression support is not configured", 
+                     c ? c->name : compression_code );
 	return (0);
 }