2018.04.23 16:00 "[Tiff] libTiff Bug", by SM

2018.04.24 20:30 "Re: [Tiff] libTiff Bug", by Roger Leigh

On 24/04/2018 20:18, SM wrote:
> Sorry forgot provide the code
>
> #include <tiffio.h>
> int main()
> {

     TIFF *tif=TIFFOpen("Test_001.tif", "r");

>     uint64 width;
>     uint64 height;

uint64 npixels=width*height;

     uint32* raster=(uint32 *) _TIFFmalloc(npixels *sizeof(uint32));

TIFFReadRGBAImage(tif, width, height, raster, 0);

> }
> This program crashes.

Isn't this because you're calling TIFFGetField with uint64 pointers rather than uint32 pointers, as expected? What are the values of width and height, and npixels?

Maybe use uint32 for the width and height, then cast to uint64 when doing the multiply (or immediately before), i.e.:

   uint32 width, height;
   TiffGetField...
   uint64 npixels = ((uint64) width) * ((uint64) height)

or similar.

Regards,
Roger