2008.02.18 00:40 "[Tiff] TIFFRead errors on faxes", by Mick O'Neill

2008.02.18 08:17 "Re: [Tiff] TIFFRead errors on faxes", by

Mick,

Once again, I have some TIFF files that cannot be read. These TIFFs have come in through the Faxman faxing software, and when I try to read them through the 3.9.0 beta library, Page 2 reports a "Read error on line xxx: Expected bbb, got ccc" error. Brava Reader and Autovue can view these images ok.

Sample tiff files available from http://midimick.com/temp/fax1.tif and http://midimick.com/temp/fax2.tif

Whilst the problem in the TIFF files is meanwhile clear, the problem in LibTiff is not, to me. I've checked both files in LibTiff and I get a flawless rendering without warnings or errors. I use LibTiff 4.0, and I get the same results in both a test of low-level LibTiff (TIFFReadEncodedXxx) and RGBA interface. Seeing the nature of the problem, that result is as expected, remainder data after reading a strip or tile is ignored in most subcodecs in LibTiff, at most a warning is emited. You may want to post your exact calling code for us to be able to reproduce, and/or cross-test with LibTiff 4.0 and see if that results in the same problem on your end.

> Inside the

> library itself, it is easy to determine that this is occurring - if the > StripOffset + StripByteCount overlaps another area of memory that has

> been mapped by another directory entry or its data, then it has > occurred.

Doing such memory-layout checking is not straightforward, nor recommended. Remember that a TIFF file has no predefined order of data blocks (for good reason). You may have many IFDs, many auxilliary tag data blocks, many strip/tile blocks, and they may be anywhere. Add to this that you may have unused space, either by first writing or as the result of later editing and re-appending of IFDs, and add to this that you may have private and unknown tags with datatype LONG that may or may not point to secondary IFDs.

Best regards,

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html