2010.02.11 21:56 "[Tiff] TIFF and IJG JPEG 8", by Bob Friesenhahn

2010.03.17 20:18 "Re: [Tiff] TIFFVStripSize overflow, JPEG decoding", by Adam Goode

On 03/16/2010 03:45 PM, Lee Cooper wrote:

I am trying to develop software to support a new tiff file source of large medical images. Using libtiff I am encountering problems with TIFFOpen, I suspect because the dimensions are causing overflow of 32-bit variables (image dimensions in the tens-of-thousands).

I am aware of the bigtiff project but that is not an option in this case since I don't have control over how the files are generated. Since I only have to support a very limited format (file organization is always the same), I am hoping to generate some simple specific code that uses header information to read the image contents. The files contain multiple "pages", each encoded with JPEG. I have listed a sample tiffdump output below.

If I have the offset from the header, is there a way to decode the output without using TIFFOpen directly? I don't mind writing some software but would prefer not to decode the JPEG from scratch :)

Regards,
Lee

NDPI! How fun. It's basically a set of crazy JPEG files and some metadata crammed into a TIFF container (Hamamatsu VMS format as TIFF). The trick is reading just enough of the header to decode the proprietary metadata tags, then reading the JPEG files directly with a JPEG decoder. Unfortunately, while it is a valid TIFF file, it is not really a viewable TIFF image (at least with libtiff).

I forget exactly where libtiff 3 overflows, but it reads 2 fields and multiplies them together, and that exceeds a 32-bit number. libtiff 4 does not overflow here.

For OpenSlide, I will eventually need to support this. I think almost all of the code for reading VMS will be adaptable if I could get libtiff to read the header. It would be nice to not require libtiff 4 for this, but I didn't have time to dig in to libtiff yet.

http://openslide.cs.cmu.edu/

Adam