1994.03.17 02:56 "I believe that I've found a bug in tif_write.c", by Dave Hylands

The function TIFFWriteTile passes "(tsize_t) -1" as the last parameter to the call TIFFWriteEncodedTile. When tsize_t was declared to be a uint32 this would be a very large positve number, however, since tsize_t has been redeclared as an int32, it is now a negative number.

TIFFWriteEncodedTile has the following test:

if (cc > tif->tif_tilesize)
   cc = tif->tif_tilesize;

This of course does nothing when cc == -1.

The "clamp" test should also test for negative numbers, or TIFFWriteTile should pass an appropriate large positive number.

I noticed this when trying to use tiffcp to convert a strip based file to a tile based file. The routine ran and produced a TIFF file with no image data.

Dave Hylands      Email: (dhylands@creo.bc.ca)      3700 Gilmore Way
Software Analyst    Tel: (604) 451-2700 (ext. 329)  Burnaby B.C. (Canada)
CREO Products Inc.  Fax: (604) 437-9891             V5G 4M1