diff options
author | fwarmerdam <fwarmerdam> | 2012-08-02 22:04:41 +0000 |
---|---|---|
committer | fwarmerdam <fwarmerdam> | 2012-08-02 22:04:41 +0000 |
commit | 0b4b871adfe0e661f9daed83743ad3ac00e0d596 (patch) | |
tree | 9d3e140435bb66d55175176c43690f27438fd3c3 | |
parent | 8c985f2e4daf24ef394c8c9c1620b4cd1d6d3c8c (diff) | |
download | libtiff-0b4b871adfe0e661f9daed83743ad3ac00e0d596.tar.gz |
warn when ignoring some corrupt tags
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | libtiff/tif_dirread.c | 16 |
2 files changed, 17 insertions, 4 deletions
@@ -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 diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c index 102e249a..2a9bec53 100644 --- a/libtiff/tif_dirread.c +++ b/libtiff/tif_dirread.c @@ -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); |