1994.01.31 12:42 "TIFF/VMS problem", by Craig Tulig

I am experiencing a problem with the TIFF 3.0 library on a VMS platform, and was wondering of you could offer any suggestions or direct me to someone who could help with a VMS/TIFF problem.

The program below crashes under TIFFClose, when run on a VMS v5.5 platform. (However, it works fine in UNIX). The cause of the problem seems to be DEC's lseek overwriting memory, resulting in the TIFF structure pointed to by the variable 'out' (below) being completely overwritten with zeroes. This subsequently leads to a crash when TIFFWriteData tries to call tif->tif_seekproc, because tif_seekproc has been overwritten with NULL.

thank you,
Craig Tulig

///////////////////////////////////////////////////////////////////////////////
// craig@cric.com             Collaborative Research Inc.                    //
// (617)487-7979 x137             1365 Main Street                           //
// (617)891-5062 (fax)           Waltham, MA. 02154                          //
///////////////////////////////////////////////////////////////////////////////

-------------------------------------------------------------------------------

#include <stdlib.h>
#include "tiffio.h"

main()
{
    unsigned char source[100];
    TIFF *out;
    int i;

    out  = TIFFOpen("test.gel", "w");
    if (!out) { printf("Open error.\n"); exit(1); }

    TIFFSetField(out, TIFFTAG_IMAGEWIDTH,      100);
    TIFFSetField(out, TIFFTAG_BITSPERSAMPLE,   (short) 8);
    TIFFSetField(out, TIFFTAG_COMPRESSION,     COMPRESSION_NONE);
    TIFFSetField(out, TIFFTAG_PHOTOMETRIC,     PHOTOMETRIC_MINISWHITE);
    TIFFSetField(out, TIFFTAG_RESOLUTIONUNIT,  (short) 1);
    TIFFSetField(out, TIFFTAG_XRESOLUTION,     (float) 10.0);
    TIFFSetField(out, TIFFTAG_YRESOLUTION,     (float) 20.0);
    TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, (short) 1);
    TIFFSetField(out, TIFFTAG_PLANARCONFIG,    (short) 1);

    for (i = 0; i < 100; i++)
    {
        if (TIFFWriteScanline(out, source, i, 0) < 0)
            { printf("write error\n"); exit(1); }

    }
    TIFFClose(out);
}

-------------------------------------------------------------------------------