2009.12.06 14:04 "[Tiff] TIFFFlushData1 return code verification", by Evgeny Fraimovitch

2009.12.06 14:04 "[Tiff] TIFFFlushData1 return code verification", by Evgeny Fraimovitch

Good time of day,

There is a certain inconsistency in TIFFFlushData1 error code handling, which can lead to unreported disk write errors. (such as when we are out of disk space)

For possibly related thread please see: *1994.10.21 15:50 "Problems catching write errors in tiff library (v3.3beta021)", by Ben Griffin* <http://www.asmail.be/msg0054980073.html>

In short: the tif_dumpmode.c DumpModeEncode returns (-1) when TIFFFlushData1 fails

         if (tif->tif_rawcc >= tif->tif_rawdatasize &&
             !TIFFFlushData1(tif))
             return (-1);

however its users expect it to return zero or non-zero value.

     LogLuvEncode24 and siblings does the same mistake.
     as does PackBitsEncode

The fix is to replace 'return (-1)' to 'return 0' in such places.

Sincerely yours,
     Evgeny
     VisionMap Ltd