AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

2001.12.09 22:17 "0xC0000005: Access Violation in TIFFReadRGBAImage()", by Keno

Hello all, I'm getting a 0xC0000005: Access Violation while in a call to the function TIFFReadRGBAImage().

What I am trying to do is discover if a TIFF file is corrupt or not. If I read the file successfully then it's ok, if not it's corrupt. I have the following code:

 TIFF* tif = TIFFOpen((LPCSTR)tmpFile, "r");

 if (tif) {
  uint32 w, h;
  size_t npixels;
  uint32* raster;

  TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
  TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
  npixels = w * h;

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

  if (raster != NULL) {
   if (TIFFReadRGBAImage(tif, w, h, raster, 0)) // ERROR OCCURS HERE
    result = true;
   _TIFFfree(raster);
  }
  TIFFClose(tif);
 }

Im using the following:

Win 2k + SP2
Visual Studio 6 + Service Pack

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

Also when building the tiff library, I included /MDd in the makefile as I have this switch present in the VC project I'm working with. I got the following warnings while building:

tif_getimage.c
tif_getimage.c(1910): warning C4550: expression evaluates to a function which i
s missing an argument list
tif_getimage.c(1911): warning C4550: expression evaluates to a function which i
s missing an argument list
tif_getimage.c(1912): warning C4550: expression evaluates to a function which i
s missing an argument list
tif_getimage.c(1913): warning C4550: expression evaluates to a function which i
s missing an argument list
tif_getimage.c(1914): warning C4550: expression evaluates to a function which i
s missing an argument list
tif_getimage.c(1915): warning C4550: expression evaluates to a function which i
s missing an argument list

- Keno -