From 8367d94a7c360f0998e0b825b3b2713176748254 Mon Sep 17 00:00:00 2001 From: Andrey Kiselev Date: Thu, 9 Feb 2006 16:15:43 +0000 Subject: [PATCH] Fix error reporting in TIFFCheckTile() as per bug http://bugzilla.remotesensing.org/show_bug.cgi?id=1063. --- libtiff/tif_tile.c | 26 +++++++++++++++++--------- 1 file 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);