tiffdec: check error returns for width/height

Change-Id: I1399a7b75aea54044f30c6a53ac11843c1e75877
This commit is contained in:
James Zern 2012-12-20 22:33:52 -08:00
parent d82a3e3391
commit 079423f5c5

View File

@ -41,8 +41,11 @@ int ReadTIFF(const char* const filename,
dircount - 1);
}
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height);
if (!(TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width) &&
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height))) {
fprintf(stderr, "Error! Cannot retrieve TIFF image dimensions.\n");
return 0;
}
raster = (uint32*)_TIFFmalloc(width * height * sizeof(*raster));
if (raster != NULL) {
if (TIFFReadRGBAImageOriented(tif, width, height, raster,