summaryrefslogtreecommitdiff
path: root/libtiff/tif_dirread.c
diff options
context:
space:
mode:
authorSu Laus <sulau@freenet.de>2023-03-12 21:05:56 +0000
committerEven Rouault <even.rouault@spatialys.com>2023-03-12 21:05:56 +0000
commitf0a7bb7bdc77b404c79592be684f3c5d234751cf (patch)
tree4de6f440b9fb5deebe5559e43c4c69a1e51d4193 /libtiff/tif_dirread.c
parent1d5b1181c980090a6518f11e61a18b0e268bf31a (diff)
downloadlibtiff-git-f0a7bb7bdc77b404c79592be684f3c5d234751cf.tar.gz
Optimize relative seeking with TIFFSetDirectory
Diffstat (limited to 'libtiff/tif_dirread.c')
-rw-r--r--libtiff/tif_dirread.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
index ef21f7f5..d4cc11d0 100644
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -4067,8 +4067,11 @@ int TIFFReadDirectory(TIFF *tif)
if (tif->tif_nextdiroff == 0)
{
- /* In this special case, tif_diroff needs also to be set to 0. */
+ /* In this special case, tif_diroff needs also to be set to 0.
+ * Furthermore, TIFFSetDirectory() needs to be switched to
+ * absolute stepping. */
tif->tif_diroff = tif->tif_nextdiroff;
+ tif->tif_setdirectory_force_absolute = TRUE;
return 0; /* last offset, thus no checking necessary */
}
@@ -5131,6 +5134,8 @@ int TIFFReadCustomDirectory(TIFF *tif, toff_t diroff,
} /*-- if (!dp->tdir_ignore) */
}
}
+ /* To be able to return from SubIFD or custom-IFD to main-IFD */
+ tif->tif_setdirectory_force_absolute = TRUE;
if (dir)
_TIFFfreeExt(tif, dir);
return 1;