2013.05.15 15:55 "[Tiff] tiffcmp does not always exit with a sensible completion code.", by Steve Underwood

Hi,

In recent versions of tiffcmp.c I find this section

     if (!CheckShortTag(tif1, tif2, TIFFTAG_BITSPERSAMPLE, "BitsPerSample"))
         return (0);
     if (!CheckShortTag(tif1, tif2, TIFFTAG_SAMPLESPERPIXEL,
"SamplesPerPixel"))
         return (0);
     if (!CheckLongTag(tif1, tif2, TIFFTAG_IMAGEWIDTH, "ImageWidth"))
         return (0);
     if (!cmptags(tif1, tif2))
         return (1);

which ensures that if I try to compare two images of different sizes the
program reports the difference and stops, but does not set the
completion code to something non-zero. A script using tiffcmp to compare
images cannot detect that the compare has failed. If I change this to:

     if (!CheckShortTag(tif1, tif2, TIFFTAG_BITSPERSAMPLE, "BitsPerSample"))
         return (1);
     if (!CheckShortTag(tif1, tif2, TIFFTAG_SAMPLESPERPIXEL,
"SamplesPerPixel"))
         return (1);
     if (!CheckLongTag(tif1, tif2, TIFFTAG_IMAGEWIDTH, "ImageWidth"))
         return (1);
     if (!cmptags(tif1, tif2))
         return (1);

I get the expected behaviour, and the program terminates with completion
status 1 as it does with any other kind of difference between the images.

Regards,
Steve