2012.09.22 18:36 "[Tiff] Libtiff 3.9.7 released", by Bob Friesenhahn

2012.10.17 17:23 "[Tiff] Que: ZIPSetupDecode errorhandling", by Henk Jan Priester

I have a tif with zip decoding and after upgrading from 3.9.4 to 4.0.3

I have a problem.

On Linux 64bit the Libtiff handles the file correct but it show many message like this.

ZIPSetupDecode: (null).

ZIPSetupDecode: (null).

ZIPSetupDecode: (null).

On Solaris it crashing when trying to display the first error message. signal SEGV (no mapping at the fault address) in strlen at 0xfee32330

0xfee32330: strlen+0x0050:      ld       [%o2], %o1

(dbx) where
=>[1] strlen(0x0, 0xfffffaf0, 0x0, 0x2d, 0x0, 0x2b), at 0xfee32330
   [2] _ndoprnt(0x1dbc5e, 0xffbfee24, 0xffbfe5d1, 0x0, 0x0, 0x0), at
0xfee9e074
   [3] vfprintf(0x1f45d0, 0x1dbc5c, 0xffbfee20, 0x90420, 0x8ff4c,
0x1f0cc4), at 0xfeea0550
   [4] .st_double_foreff(0x1abecf, 0x1dbc5c, 0xffbfee20, 0x1f1400,
0x1f1400, 0x1d4800), at 0x262d8

   [5] TIFFErrorExt(0x5, 0x1abecf, 0x1dbc5c, 0x0, 0x0, 0x0), at 0x43d90
   [6] 0x99ef8(0x21a300, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x99ef8
   [7] 0x95eb8(0x21a300, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x95eb8
   [8] 0x59c70(0x21a300, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x59c70
   [9] TIFFFillStrip(0x21a300, 0x0, 0xffbff064, 0xfffffff9, 0x0, 

0x2371b1), at 0x58ad8

The problem is that in the routine ZIPSetupDecode the function 'inflateInit' return -2 (Z_STREAM)

and sp->stream.msg is NULL

if (inflateInit(&sp->stream) != Z_OK) {
                 TIFFErrorExt(tif->tif_clientdata, module, "%s",
sp->stream.msg);
                 return (0);

The workaround seems to do:
if (inflateInit(&sp->stream) != Z_OK) {
                 if ( sp->stream.msg != NULL )
                          TIFFErrorExt(tif->tif_clientdata, module,
"%s", sp->stream.msg);
                 return (0);

Any suggesstion what the best solution is?