* libtiff/tif_dirread.c: when compiled with DEFER_STRILE_LOAD,

fix regression, introduced on 2014-12-23, when reading a one-strip
file without a StripByteCounts tag. GDAL #6490
This commit is contained in:
Even Rouault 2016-04-27 11:38:00 +00:00
parent c7ff695d1b
commit 958d9b5a8d
2 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2016-04-27 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_dirread.c: when compiled with DEFER_STRILE_LOAD,
fix regression, introduced on 2014-12-23, when reading a one-strip
file without a StripByteCounts tag. GDAL #6490
2016-04-07 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
* html/bugs.html: Replace Andrey Kiselev with Bob Friesenhahn for

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirread.c,v 1.200 2016-01-03 10:01:25 erouault Exp $ */
/* $Id: tif_dirread.c,v 1.201 2016-04-27 11:38:00 erouault Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -166,6 +166,8 @@ static int TIFFFetchSubjectDistance(TIFF*, TIFFDirEntry*);
static void ChopUpSingleUncompressedStrip(TIFF*);
static uint64 TIFFReadUInt64(const uint8 *value);
static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount );
typedef union _UInt64Aligned_t
{
double d;
@ -4281,7 +4283,8 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
TIFFDirectory *td = &tif->tif_dir;
uint32 strip;
if( !_TIFFFillStriles( tif ) )
/* Do not try to load stripbytecount as we will compute it */
if( !_TIFFFillStrilesInternal( tif, 0 ) )
return -1;
if (td->td_stripbytecount)
@ -5568,6 +5571,11 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
}
int _TIFFFillStriles( TIFF *tif )
{
return _TIFFFillStrilesInternal( tif, 1 );
}
static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount )
{
#if defined(DEFER_STRILE_LOAD)
register TIFFDirectory *td = &tif->tif_dir;
@ -5585,7 +5593,8 @@ int _TIFFFillStriles( TIFF *tif )
return_value = 0;
}
if (!TIFFFetchStripThing(tif,&(td->td_stripbytecount_entry),
if (loadStripByteCount &&
!TIFFFetchStripThing(tif,&(td->td_stripbytecount_entry),
td->td_nstrips,&td->td_stripbytecount))
{
return_value = 0;
@ -5610,6 +5619,7 @@ int _TIFFFillStriles( TIFF *tif )
return return_value;
#else /* !defined(DEFER_STRILE_LOAD) */
(void) tif;
(void) loadStripByteCount;
return 1;
#endif
}