fixed handling of tiled logluv images (#2005)

This commit is contained in:
Frank Warmerdam 2009-02-12 18:06:17 +00:00
parent a62c54d6f8
commit 15760800eb
2 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2009-02-12 Frank Warmerdam <warmerdam@pobox.com>
* libtiff/tif_luv.c: Fix handling of tiled logluv images.
http://bugzilla.maptools.org/show_bug.cgi?id=2005
2009-02-09 Frank Warmerdam <warmerdam@pobox.com> 2009-02-09 Frank Warmerdam <warmerdam@pobox.com>
* libtiff/tif_dirread.c: Improve allocation safety when allocated * libtiff/tif_dirread.c: Improve allocation safety when allocated

View File

@ -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 * Copyright (c) 1997 Greg Ward Larson
@ -1247,6 +1247,9 @@ LogL16InitState(TIFF* tif)
"No support for converting user data format to LogL"); "No support for converting user data format to LogL");
return (0); return (0);
} }
if( isTiled(tif) )
sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength);
else
sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip); sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
if (multiply_ms(sp->tbuflen, sizeof (int16)) == 0 || if (multiply_ms(sp->tbuflen, sizeof (int16)) == 0 ||
(sp->tbuf = (uint8*) _TIFFmalloc(sp->tbuflen * sizeof (int16))) == NULL) { (sp->tbuf = (uint8*) _TIFFmalloc(sp->tbuflen * sizeof (int16))) == NULL) {
@ -1344,6 +1347,9 @@ LogLuvInitState(TIFF* tif)
"No support for converting user data format to LogLuv"); "No support for converting user data format to LogLuv");
return (0); return (0);
} }
if( isTiled(tif) )
sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength);
else
sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip); sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
if (multiply_ms(sp->tbuflen, sizeof (uint32)) == 0 || if (multiply_ms(sp->tbuflen, sizeof (uint32)) == 0 ||
(sp->tbuf = (uint8*) _TIFFmalloc(sp->tbuflen * sizeof (uint32))) == NULL) { (sp->tbuf = (uint8*) _TIFFmalloc(sp->tbuflen * sizeof (uint32))) == NULL) {