Skip to content

Commit

Permalink
Merge branch 'fix-tiff-warnings-for-release' into release-5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Nov 5, 2024
2 parents 10a10ea + 15e4717 commit dc9ab03
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
27 changes: 18 additions & 9 deletions Modules/ThirdParty/TIFF/src/itktiff/tif_dirread.c
Original file line number Diff line number Diff line change
Expand Up @@ -3538,9 +3538,12 @@ TIFFReadDirectory(TIFF* tif)
TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii);
if (fii == FAILED_FII)
{
TIFFWarningExt(tif->tif_clientdata, module,
"Unknown field with tag %d (0x%x) encountered",
dp->tdir_tag,dp->tdir_tag);
if (tif->tif_flags&TIFF_WARNABOUTUNKNOWNTAGS)
{
TIFFWarningExt(tif->tif_clientdata, module,
"Unknown field with tag %d (0x%x) encountered",
dp->tdir_tag,dp->tdir_tag);
}
/* the following knowingly leaks the
anonymous field structure */
if (!_TIFFMergeFields(tif,
Expand Down Expand Up @@ -4181,16 +4184,22 @@ TIFFReadCustomDirectory(TIFF* tif, toff_t diroff,
TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii);
if (fii == FAILED_FII)
{
TIFFWarningExt(tif->tif_clientdata, module,
"Unknown field with tag %d (0x%x) encountered",
dp->tdir_tag, dp->tdir_tag);
if (tif->tif_flags&TIFF_WARNABOUTUNKNOWNTAGS)
{
TIFFWarningExt(tif->tif_clientdata, module,
"Unknown field with tag %d (0x%x) encountered",
dp->tdir_tag, dp->tdir_tag);
}
if (!_TIFFMergeFields(tif, _TIFFCreateAnonField(tif,
dp->tdir_tag,
(TIFFDataType) dp->tdir_type),
1)) {
TIFFWarningExt(tif->tif_clientdata, module,
"Registering anonymous field with tag %d (0x%x) failed",
dp->tdir_tag, dp->tdir_tag);
if (tif->tif_flags&TIFF_WARNABOUTUNKNOWNTAGS)
{
TIFFWarningExt(tif->tif_clientdata, module,
"Registering anonymous field with tag %d (0x%x) failed",
dp->tdir_tag, dp->tdir_tag);
}
dp->tdir_tag=IGNORE;
} else {
TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii);
Expand Down
3 changes: 3 additions & 0 deletions Modules/ThirdParty/TIFF/src/itktiff/tif_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ TIFFClientOpen(
if (m&O_CREAT)
tif->tif_flags |= TIFF_BIGTIFF;
break;
case 'W':
tif->tif_flags |= TIFF_WARNABOUTUNKNOWNTAGS;
break;
}
/*
* Read in TIFF header.
Expand Down
1 change: 1 addition & 0 deletions Modules/ThirdParty/TIFF/src/itktiff/tiffiop.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ struct tiff {
#define TIFF_DIRTYSTRIP 0x200000 /* stripoffsets/stripbytecount dirty*/
#define TIFF_PERSAMPLE 0x400000 /* get/set per sample tags as arrays */
#define TIFF_BUFFERMMAP 0x800000 /* read buffer (tif_rawdata) points into mmap() memory */
#define TIFF_WARNABOUTUNKNOWNTAGS 0x1000000 /* emit a warning when encountering a unknown tag */
uint64 tif_diroff; /* file offset of current directory */
uint64 tif_nextdiroff; /* file offset of following directory */
uint64* tif_dirlist; /* list of offsets to already seen directories to prevent IFD looping */
Expand Down

0 comments on commit dc9ab03

Please sign in to comment.