diff options
author | Andrey Kiselev <dron@ak4719.spb.edu> | 2006-02-09 16:15:43 +0000 |
---|---|---|
committer | Andrey Kiselev <dron@ak4719.spb.edu> | 2006-02-09 16:15:43 +0000 |
commit | 8367d94a7c360f0998e0b825b3b2713176748254 (patch) | |
tree | d22ae0bd5f9b7ce8a96a4de0de95f835a028df71 /libtiff/tif_tile.c | |
parent | be7063caea5dbe8e940c62d731d812f6af3c09b0 (diff) | |
download | libtiff-git-8367d94a7c360f0998e0b825b3b2713176748254.tar.gz |
Fix error reporting in TIFFCheckTile() as per bug
http://bugzilla.remotesensing.org/show_bug.cgi?id=1063.
Diffstat (limited to 'libtiff/tif_tile.c')
-rw-r--r-- | libtiff/tif_tile.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/libtiff/tif_tile.c b/libtiff/tif_tile.c index 063a663a..7e8dbfb5 100644 --- a/libtiff/tif_tile.c +++ b/libtiff/tif_tile.c @@ -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); |