AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1994.02.12 15:48 "TIFFGetField bug?", by Claude_S._Fillion.ROCH803@xerox.com
1994.02.15 12:33 "Re: TIFFGetField bug", by Claude_S._Fillion.ROCH803@xerox.com
1994.02.15 20:59 "Re: TIFFGetField bug", by Dan McCoy

1994.02.15 20:59 "Re: TIFFGetField bug", by Dan McCoy

I found out why I was getting incorrect values returned from GetField, strip chop support is enabled by default. Strip chop support seems like a feature that could use some work. One of the files I was testing with was only 5k and has a correct rowsperstrip value of 200. Strip chop support changed the rowsperstrip to 372. I would have assumed that if a file size is under 8k the rowsperstrip value would not be changed.

It's a bug. (I guess I never make images that small.) The routine "ChopUpSingleUncompressedStrip" should never increase the rowsperstrip value.

The fix is to add one line to tif_dirread.c (Well two, counting the comment.)

Dan McCoy    Pixar    mccoy@pixar.com

--------------------------------------------------------------
*** tif_dirread.c.orig  Thu Aug 26 21:27:30 1993
--- tif_dirread.c       Tue Feb 15 15:56:20 1994
***************
*** 1204,1209 ****
--- 1204,1211 ----
                rowsperstrip = 8192 / rowbytes;
                stripbytes = rowbytes * rowsperstrip;
        }
+       /* Never make rowsperstrip larger. */
+       if (td->td_rowsperstrip <= rowsperstrip) return;
        nstrips = howmany(bytecount, stripbytes);
        newcounts = (uint32*) CheckMalloc(tif, nstrips * sizeof (uint32),
                                "for chopped \"StripByteCounts\" array");