AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2018.04.23 16:00 "[Tiff] libTiff Bug", by SM
2018.04.23 16:08 "Re: [Tiff] libTiff Bug", by Bob Friesenhahn
2018.04.24 20:18 "Re: [Tiff] libTiff Bug", by SM
2018.04.24 18:23 "Re: [Tiff] libTiff Bug", by SM
2018.04.24 18:35 "Re: [Tiff] libTiff Bug", by Even Rouault
2018.04.24 19:04 "Re: [Tiff] libTiff Bug", by Bob Friesenhahn
2018.04.24 20:14 "Re: [Tiff] libTiff Bug", by SM
2018.04.24 20:30 "Re: [Tiff] libTiff Bug", by Roger Leigh
2018.04.23 16:17 "Re: [Tiff] libTiff Bug", by Even Rouault
2018.04.23 16:29 "Re: [Tiff] libTiff Bug", by SM
2018.04.23 16:41 "Re: [Tiff] libTiff Bug", by SM
2018.04.23 19:11 "Re: [Tiff] libTiff Bug", by SM
2018.04.23 19:14 "Re: [Tiff] libTiff Bug", by Bob Friesenhahn

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