2019.10.01 18:01 "[Tiff] TIFF_IO_MAX too large for Windows XP", by David C. Partridge

2019.10.10 18:41 "Re: [Tiff] TIFF_IO_MAX too large for Windows XP", by Roger Leigh

On 10/10/2019 13:10, David C. Partridge wrote:

Yes, I also see that for x64 the limit was 32MB minus a bit. So for my code I have set a safe limit of 16MB.

I like to propose that this be adopted into the official codebase :)

So the code now looks like (starting at line 58 of tif_unix.c):

#endif

#define TIFF_IO_MAX 2147483647U

You don't need to call on every invocation of I/O.  It could be a static, initialised at program startup or even internal to this function and initialised on the first call:

BOOL IsWindowsXP()
{
   static BOOL initialised = 0;
   static BOOL isXp = 0;

   if (!initialised) {
     DWORD version = GetVersion();
     DWORD major = (DWORD)(LOBYTE(LOWORD(version)));
     DWORD minor = (DWORD)(HIBYTE(LOWORD(version)));
     isXp = ((major == 5) && (minor >= 1)); // 5.1 is WIN Xp 5.2 is XP x64
     initialised = 1;
   }

   return isXp;
}

That said, I'm against including code of this nature, when we don't have adequate testing or CI coverage.  It's a recipe for future regressions if the XP codepaths are not tested.  It's difficult for a volunteer-driven project to adequately support and maintain dead platforms.  There is a cost to adding and maintaining this support, which needs to be borne in mind.  As is the quality of the support if it's not being actively and routinely tested.  While I am willing to test, use and support libtiff on a wide range of contemporary platforms, Windows XP is not such a platform.

Regards,

Roger