AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2009.02.12 13:23 "[Tiff] Bug in tif_luv.c (and a fix)", by Ive
2009.02.12 16:26 "Re: [Tiff] Bug in tif_luv.c (and a fix)", by Frank Warmerdam

2009.02.12 16:26 "Re: [Tiff] Bug in tif_luv.c (and a fix)", by Frank Warmerdam

This effects only Photometric LogLUV images that are tiled. I guess LogLUV was quite rarely used and all the example images from Greg Ward's side are in strips, but with the current HDRI hype I stumbled across a HDR LogLUV tiff that crashed my application.

So the bug may be there for quite some time, but it definitely is in tiff-4.0beta3 and tiff_3.9.0beta.

In tif_luv.c the functions LogL16InitState and LogLuvInitState contain the statement (at line 1250 & 1347)

sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);

this should be replaced by

if (!(isTiled(tif)))
    sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip);
else
    sp->tbuflen = multiply(td->td_tilewidth, td->td_tilelength);

and all works fine again.

Note that Greg Wards LogLUV code already contained correct functions to be glued with tiled images and tiled LogLUV images are absolutely valid. I can provide an example tiff that shows the bug if someone needs it.

Ive,

I have filed this in bugzilla as:

   http://bugzilla.maptools.org/show_bug.cgi?id=2005

Would you happen to have a modest sized test image I can use to reproduce the bug and confirm the fix?

Best regards,
--
---------------------------------------+--------------------------------------

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam

and watch the world go round - Rush    | Geospatial Programmer for Rent