2017.05.21 19:28 "[Tiff] Libtiff 4.0.8 released", by Bob Friesenhahn

2017.05.24 20:06 "Re: [Tiff] Sporadic crash on Windows when appending images to TIFF file", by Vincent Torri

On Wed, May 24, 2017 at 5:42 PM, Dinesh Iyer <dsi.maillist@gmail.com> wrote:

> I am using libTIFF 4.0.0 and I am receiving a sporadic error/crash when I am > trying to write multiple images to a TIFF file only on Windows.

I have not yet been able to generate simplified reproduction steps but the outline of the code that results in this error is below:

// Write the first image
TIFF* tif = TIFFOpenW(fileName, "w");

// Set Tags before writing images
// Write the first image
TIFFClose(tif);

// Call the code below repeatedly say 500 times. An error/crash happens sporadically

TIFF* tif = TIFFOpenW(fileName, "a");

// Set Tags before writing images
// Write the first image
TIFFClose(tif);

There are no calls to TIFFWriteDirectory or TIFFSetDirectory in my code.

In some instances, opening the file fails because there are no write permissions. Other times, I get a crash with the following trace: Stack Trace (from fault):

[ 0] 0x00000000084321a0 TIFFFindField at C:\temp\amake_2263_6088\win64\tiff\libtiff\tif_dirinfo.c:490 [ 1] 0x000000000842dd47 OkToChangeTag at c:\temp\amake_2263_6088\win64\tiff\libtiff\tif_dir.c:691 [ 2] 0x000000000842f574 TIFFSetField at c:\temp\amake_2263_6088\win64\tiff\libtiff\tif_dir.c:726 [ 3] 0x000000000842c3df writeTIFFTags (my function) <SNIP>

I am always writing to a local disk and not any network location. Just for testing, I added a pause of 0.5 seconds after writing each image and it reduced the frequency of the error/crash. Any thoughts?

Also, is there a way for me to build libtiff in debug mode on Windows so that i can do some more investigation on my end?

Are you using Visual Studio or MSYS/mingw?

Drmemory is a good tool to find problems on Windows (it's a valgrind-like tool)

Vincent Torri