Add runtime check in TIFFFetchNormalTag()

This commit is contained in:
Frank Warmerdam 2007-08-24 20:45:59 +00:00
parent 3c78b558ae
commit 4baacb150b
2 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2007-08-24 Frank Warmerdam <warmerdam@pobox.com>
* tif_dirread.c: Add runtime error for fields for which no definition
is found (in addition to an assert for developers) in
TIFFFetchNormalTag(). Not sure if this is needed, but it seems
prudent.
2007-08-10 Joris Van Damme <joris.at.lebbeke@skynet.be>
* libtiff/tif_getimage.c: removed SubsamplingHor and SubsamplingVer

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirread.c,v 1.129 2007-07-18 16:06:05 dron Exp $ */
/* $Id: tif_dirread.c,v 1.130 2007-08-24 20:46:00 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -4502,6 +4502,13 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
const TIFFField* fip;
TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii);
assert(fii!=0xFFFFFFFF);
if( fii == 0xFFFFFFFF )
{
TIFFErrorExt(tif->tif_clientdata, "TIFFFetchNormalTag",
"No definition found for tag %d",
dp->tdir_tag);
return 0;
}
fip=tif->tif_fields[fii];
assert(fip->set_field_type!=TIFF_SETGET_OTHER); /* if so, we shouldn't arrive here but deal with this in specialized code */
assert(fip->set_field_type!=TIFF_SETGET_INT); /* if so, we shouldn't arrive here as this is only the case for pseudo-tags */