TIFF and LibTiff Mail List Archive


1999.11.08 16:06 "Questions", by Andy
1999.11.18 14:10 "Re: Questions", by Andy

1999.11.08 16:06 "Questions", by Andy

Dear Sirs,

I use libtiff 3.4beta037 on Windows. I get some errors with software with the libtiff. I think it is most likely my code, yet see not where it would generate these errors.

Here's one. I have a batch of single strip one page Group IV files. I open each file, read-only, get some fields, read a raw strip, and close the TIFF. Sometimes, I get an access violation in "TIFFFreeDirectory", on the CleanupFields(stripbytecounts) macro, which tests the variable against NULL and if not then frees it as it was previously allocated. This occurs when some number of images is opened in sequence, but strangely not more or less.

Here's another one. Again, a TIFF file is opened read-only. Then, some fields are read. For example, the stripbytecounts array can be read. Well, what happens is when TIFFReadEncodedStrip is used, then on often the last strip it will get an invalid byte count, throw TIFFError and return -1. In the function TIFFReadEncodedStrip, when this proceeds to call TIFFFillStrip, then in this function an invalid byte count from td->td_stripbytecount[strip] is used, and thus the function passes to TIFFError this, for example: "Read error on strip 0; got 65710 bytes, expected 4718708," where 4718708 is the bogus byte count. So, I am thinking that an invalid byte count array has been allocated, as at points later it will be unable to free this or the stripoffsets array.

Another example TIFFError message is "Read error on strip 1; got 5423282 bytes, expected 5770208". Here, again, as an example, it is possible to call TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbytecounts), and each member of this array is valid. Any other field from TIFFGetField is valid.

I am thinking these images are otherwise correct, and open in other software.

Can someone help me? I hope so. I would peruse the tiff@sgi archives if they were at all available. Is there any archive of this list's predecessor?

Here are things I think might be wrong:

  1. : build options - library built with tif_win32.c, w or w/o JPEG and zip, debug or not
  2. : client code error - is there any way calls to open, read and close functions could cause malfunction? There are no compiler warnings.
  3. : OS issue - I build this also on Linux and have issues that could be further explored
  4. : libtiff issue -

Well, here's for hoping. I write my own code for simple images, but would prefer to use libtiff for comprehensiveness and re-wheel.

Here's something on a different subject, about reading TIFF and tag order, a comment in the libtiff code says some TIFFs do not obey tag order. About 3.5.2 on NT, I have not done so.

Generally, I wonder about what is TIFF 7.0. Is there a note on Zip in TIFF? I have read much of libtiff source code, TIFF 6.0 spec, TIFF 5.0 spec, TTN1 and 2.

Have a nice day,