2005.06.17 19:49 "[Tiff] Fix for corrupted multipage TIFF", by Steve Roy

2005.06.23 14:38 "Re: [Tiff] Fix for corrupted multipage TIFF", by Steve Roy

If we were to incorporate such handling, I think it might be best to control whether it is used based on an extra open flag indicating that an error should not cause complete failure.

I was not familiar with the LibTiff code so I didn't think of that but it sounds like the right way to go so I attempted to implement it. Here are my changes. I don't know if they are all correct, and I'm not sure how to "officially" submit code changes, so feel free to let me know.

I thought it would be good to add an h flag corresponding to TIFF_HEADERONLY.

In tiffiop.h

Added:

#define    TIFF_HEADERONLY        0x10000    /* read header only */

In tif_open.c, in TIFFClientOpen()

In the mode switch, I added a case for 'h':

         case 'h':
             tif->tif_flags |= TIFF_HEADERONLY;
             break;

Before the block that sets up the initial directory, I added:

     if (tif->tif_flags & TIFF_HEADERONLY)
         return (tif);

What do you think?

Steve

Steve Roy <sroy@mac.com>
Personal homepage: <http://homepage.mac.com/sroy>
Projects homepage: <http://www.roydesign.net>