TIFF and LibTiff Mail List Archive


2004.12.23 16:34 "[Tiff] TIFF_BEENWRITING", by Bill Bither
2004.12.26 15:47 "Re: [Tiff] TIFF_BEENWRITING", by Frank Warmerdam

2004.12.26 15:47 "Re: [Tiff] TIFF_BEENWRITING", by Frank Warmerdam

As of version 3.6.1, there has been a problem with the function TIFFWriteCheck in tiff_write.c. The code

Tif->tif_flags |= TIFF_BEENWRITING causes an overflow problem with GDI+ in .NET. When I comment it out, it appears to be fine. Please see bug 719 for reference. What does that flag do? Any ideas on the real bug fix here?


My understanding is that this flag is used to determine if any imagery has been written yet. When the first image data is written, this flag is after various conditions are tested. Thereafter various image configuration information (width, height, etc) becomes fixed. This seem to be supported by the comment in TIFFWriteCheck():

         * On the first write verify all the required information
         * has been setup and initialize any data structures that
         * had to wait until directory information was set.
         * Note that a lot of our work is assumed to remain valid
         * because we disallow any of the important parameters
         * from changing after we start writing (i.e. once
         * TIFF_BEENWRITING is set, TIFFSetField will only allow
         * the image's length to be changed).

I have skimmed 719 a couple times, but I am not terribly optimistic it will be easy to isolate and correct the problem with the information given. I, for one, don't have particularly good memory corruptions testing tools for win32, not any familiarity with the .net environment so I am not sure it will be easy to reproduce the problem with the given environment. If the problem could be reproduced with a C program that we could also run on linux that would be helpful, as the valgrind tool is very helpful for isolating heap corruption or other memory bugs.

If anyone else on the list is feeling ambitious feel free to take a swing at bug 719.

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam,
light and sound - activate the windows |
and watch the world go round - Rush    | Geospatial Programmer for Rent