2010.03.16 17:38 "[Tiff] Heap corruption reading ICC profiles under windows", by Dan Pidcock

2010.03.16 17:38 "[Tiff] Heap corruption reading ICC profiles under windows", by Dan Pidcock

When I use tiff lib under windows to read a TIFF that has an embedded ICC profile (created by Adobe Photoshop CS3) I am seeing heap corruption in TIFFFreeDirectory when calling _TIFFfree for the custom tag. Is this a known issue or some problem with my configuration that I need to sort out? I have tried 3.8.2 and 4.0.0beta5 versions of tiff lib.

I built tiff lib using nmake after modifying the nmake.opt file to comment out USE_WIN_CRT_LIB = 1.

The code I am using to test is:

    TIFF* tif = TIFFOpen(argv[1], "r");
    if (tif) {
        unsigned long profileSize;
        unsigned char *rawIccProfile = NULL;
        if (TIFFGetField (tif, TIFFTAG_ICCPROFILE, &profileSize,
&rawIccProfile))
            _TIFFfree(rawIccProfile);
        TIFFClose(tif);
    }

which is fundamentally the same as that used at http://www.littlecms.com/tiffemb.c and http://www.freecolormanagement.com/download/tiff_icc.diff

Any ideas gratefully received,

Dan