Fix error reporting in TIFFCheckTile() as per bug

http://bugzilla.remotesensing.org/show_bug.cgi?id=1063.
This commit is contained in:
Andrey Kiselev 2006-02-09 16:15:43 +00:00
parent be7063caea
commit 8367d94a7c

View File

@ -1,4 +1,4 @@
/* $Id: tif_tile.c,v 1.11 2005-12-21 12:23:13 joris Exp $ */
/* $Id: tif_tile.c,v 1.12 2006-02-09 16:15:43 dron Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@ -107,24 +107,32 @@ TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, tsample_t s)
TIFFDirectory *td = &tif->tif_dir;
if (x >= td->td_imagewidth) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Col out of range, max %lu",
(unsigned long) x, (unsigned long) td->td_imagewidth);
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"%lu: Col out of range, max %lu",
(unsigned long) x,
(unsigned long) (td->td_imagewidth - 1));
return (0);
}
if (y >= td->td_imagelength) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Row out of range, max %lu",
(unsigned long) y, (unsigned long) td->td_imagelength);
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"%lu: Row out of range, max %lu",
(unsigned long) y,
(unsigned long) (td->td_imagelength - 1));
return (0);
}
if (z >= td->td_imagedepth) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Depth out of range, max %lu",
(unsigned long) z, (unsigned long) td->td_imagedepth);
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"%lu: Depth out of range, max %lu",
(unsigned long) z,
(unsigned long) (td->td_imagedepth - 1));
return (0);
}
if (td->td_planarconfig == PLANARCONFIG_SEPARATE &&
s >= td->td_samplesperpixel) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Sample out of range, max %lu",
(unsigned long) s, (unsigned long) td->td_samplesperpixel);
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"%lu: Sample out of range, max %lu",
(unsigned long) s,
(unsigned long) (td->td_samplesperpixel - 1));
return (0);
}
return (1);