Merge "tiffdec: check error returns for width/height"

This commit is contained in:
pascal massimino 2012-12-22 06:29:23 -08:00 committed by Gerrit Code Review
commit 2b9048e324

View File

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