warn when ignoring some corrupt tags
This commit is contained in:
parent
2d7f2b7452
commit
76cb1b57bf
@ -1,3 +1,8 @@
|
||||
2012-08-02 Frank Warmerdam <warmerdam@google.com>
|
||||
|
||||
* libtiff/tif_dirread.c: report error in case of mismatch value
|
||||
counts for tags (ie. DotRange).
|
||||
|
||||
2012-07-26 Tom Lane <tgl@sss.pgh.pa.us>
|
||||
|
||||
* libtiff/{tiffio.h, tif_dirinfo.c, libtiff.def}: Add six new
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: tif_dirread.c,v 1.176 2012-07-07 14:43:17 bfriesen Exp $ */
|
||||
/* $Id: tif_dirread.c,v 1.177 2012-08-02 22:04:41 fwarmerdam Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -4860,8 +4860,12 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
|
||||
uint16* data;
|
||||
assert(fip->field_readcount==2);
|
||||
assert(fip->field_passcount==0);
|
||||
if (dp->tdir_count!=2)
|
||||
if (dp->tdir_count!=2) {
|
||||
TIFFWarningExt(tif->tif_clientdata,module,
|
||||
"incorrect count for field \"%s\", expected 2, got %d",
|
||||
fip->field_name,(int)dp->tdir_count);
|
||||
return(0);
|
||||
}
|
||||
err=TIFFReadDirEntryShortArray(tif,dp,&data);
|
||||
if (err==TIFFReadDirEntryErrOk)
|
||||
{
|
||||
@ -4878,8 +4882,12 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
|
||||
uint8* data;
|
||||
assert(fip->field_readcount>=1);
|
||||
assert(fip->field_passcount==0);
|
||||
if (dp->tdir_count!=(uint64)fip->field_readcount)
|
||||
/* corrupt file */;
|
||||
if (dp->tdir_count!=(uint64)fip->field_readcount) {
|
||||
TIFFWarningExt(tif->tif_clientdata,module,
|
||||
"incorrect count for field \"%s\", expected 2, got %d",
|
||||
fip->field_name,(int) fip->field_readcount, (int)dp->tdir_count);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
err=TIFFReadDirEntryByteArray(tif,dp,&data);
|
||||
|
Loading…
Reference in New Issue
Block a user