Fixed problem in TIFFReadDirectory() in the code, responsible for tag data type

checking.
This commit is contained in:
Andrey Kiselev 2004-08-20 14:40:10 +00:00
parent 8b8023bb51
commit d0a81ad681

View File

@ -1,4 +1,4 @@
/* $Id: tif_dirread.c,v 1.30 2004-04-29 07:42:33 dron Exp $ */
/* $Id: tif_dirread.c,v 1.31 2004-08-20 14:40:10 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -272,8 +272,9 @@ TIFFReadDirectory(TIFF* tif)
tif->tif_fieldinfo[fix]->field_tag != dp->tdir_tag) {
TIFFWarning(module,
"%.1000s: unknown field with tag %d (0x%x) encountered",
tif->tif_name, dp->tdir_tag, dp->tdir_tag);
"%.1000s: unknown field with tag %d (0x%x) and type %d encountered",
tif->tif_name, dp->tdir_tag, dp->tdir_tag,
dp->tdir_type);
TIFFMergeFieldInfo( tif,
_TIFFCreateAnonFieldInfo( tif,
@ -296,17 +297,18 @@ TIFFReadDirectory(TIFF* tif)
/*
* Check data type.
*/
fip = tif->tif_fieldinfo[fix];
while (dp->tdir_type != (u_short) fip->field_type) {
fip = tif->tif_fieldinfo[fix++];
while (dp->tdir_type != (u_short) fip->field_type
&& fix < tif->tif_nfields) {
if (fip->field_type == TIFF_ANY) /* wildcard */
break;
fip++, fix++;
if (fix == tif->tif_nfields ||
fip = tif->tif_fieldinfo[fix++];
if (fix >= tif->tif_nfields ||
fip->field_tag != dp->tdir_tag) {
TIFFWarning(module,
"%.1000s: wrong data type %d for \"%s\"; tag ignored",
tif->tif_name, dp->tdir_type,
fip[-1].field_name);
tif->tif_fieldinfo[fix-1]->field_name);
goto ignore;
}
}