2016.08.07 03:52 "[Tiff] fax2tiff in libtiff 4.0.5 and 4.0.6", by Steve Underwood
Up to libtiff 4.0.4 the fax2tiff utility worked OK. In libtiff 4.0.5 and 4.0.6 it is broken. On Linux machines it says "Not enough memory" for any G3 fax file you pass to it. I have not tested with OS/X or Windows.
if I use the fax2tiff.c file from libtiff 4.0.4 with libtiff 4.0.6 everything works OK. Someone changed the way client data is handled in fax2tiff.c, and I don't understand what they were trying to achieve. This means I am not certain that going back to the version from 4.0.4 is really the right thing to do. Below is a diff between the 4.0.4 and 4.0.6 versions. The comment in the 4.0.6 code which says "Note that it does not appear that the client data is actually used in this program." is clearly incorrect. The client data is definitely used. If you don't set it, the program crashes.
Can anyone shed some light on the goal of this change?
< /* $Id: fax2tiff.c,v 1.23 2015-06-21 01:09:10 bfriesen Exp $ */
> /* $Id: fax2tiff.c,v 1.24 2015-08-23 15:40:45 bfriesen Exp $ */
> Struct to carry client data. Note that it does not appear that the
> data is actually used in this program.
> typedef struct _FAX_Client_Data
> #if defined(_WIN32) && defined(USE_WIN32_FILEIO)
> intptr_t fh; /* Operating system file handle */
> int fd; /* Integer file descriptor */
> } FAX_Client_Data;
> FAX_Client_Data client_data;
> client_data.fh = _get_osfhandle(fileno(in));
< TIFFSetClientdata(faxTIFF, (thandle_t)fileno(in));
> client_data.fd = fileno(in);
> TIFFSetClientdata(faxTIFF, (thandle_t) &client_data);