From 15760800eb076e1ca7182b8146b9c031958f4b7f Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Thu, 12 Feb 2009 18:06:17 +0000 Subject: [PATCH] fixed handling of tiled logluv images (#2005) --- ChangeLog | 5 +++++ libtiff/tif_luv.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca4cdcf4..3a1d9648 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-02-12 Frank Warmerdam + + * libtiff/tif_luv.c: Fix handling of tiled logluv images. + http://bugzilla.maptools.org/show_bug.cgi?id=2005 + 2009-02-09 Frank Warmerdam * libtiff/tif_dirread.c: Improve allocation safety when allocated diff --git a/libtiff/tif_luv.c b/libtiff/tif_luv.c index e7480542..80cb6ae1 100644 --- a/libtiff/tif_luv.c +++ b/libtiff/tif_luv.c @@ -1,4 +1,4 @@ -/* $Id: tif_luv.c,v 1.31 2007-07-19 13:25:43 dron Exp $ */ +/* $Id: tif_luv.c,v 1.32 2009-02-12 18:06:17 fwarmerdam Exp $ */ /* * Copyright (c) 1997 Greg Ward Larson @@ -1247,7 +1247,10 @@ LogL16InitState(TIFF* tif) "No support for converting user data format to LogL"); return (0); } - sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip); + if( isTiled(tif) ) + sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength); + else + sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip); if (multiply_ms(sp->tbuflen, sizeof (int16)) == 0 || (sp->tbuf = (uint8*) _TIFFmalloc(sp->tbuflen * sizeof (int16))) == NULL) { TIFFErrorExt(tif->tif_clientdata, module, "No space for SGILog translation buffer"); @@ -1344,7 +1347,10 @@ LogLuvInitState(TIFF* tif) "No support for converting user data format to LogLuv"); return (0); } - sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip); + if( isTiled(tif) ) + sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength); + else + sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip); if (multiply_ms(sp->tbuflen, sizeof (uint32)) == 0 || (sp->tbuf = (uint8*) _TIFFmalloc(sp->tbuflen * sizeof (uint32))) == NULL) { TIFFErrorExt(tif->tif_clientdata, module, "No space for SGILog translation buffer");