summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2023-03-26 15:51:21 +0000
committerEven Rouault <even.rouault@spatialys.com>2023-03-26 15:51:21 +0000
commit17adf4308cc90d1263774d0a120af65a5fc147fa (patch)
tree12048360516ff074e27f7578128265b33e9bc9ef
parent214fe59954644efe69c4681587d0dee64575dd0c (diff)
parentb8b12c44c1a8c622fc98f8e76f66e5e5edac3b8e (diff)
downloadlibtiff-git-17adf4308cc90d1263774d0a120af65a5fc147fa.tar.gz
Merge branch 'tif_ovrcache_TIFFSetSubDirectory' into 'master'
tif_ovrcache.c: check TIFFSetSubDirectory() return value (CID 1524573) See merge request libtiff/libtiff!478
-rw-r--r--contrib/addtiffo/tif_ovrcache.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/addtiffo/tif_ovrcache.c b/contrib/addtiffo/tif_ovrcache.c
index 4153189b..9cbf09d1 100644
--- a/contrib/addtiffo/tif_ovrcache.c
+++ b/contrib/addtiffo/tif_ovrcache.c
@@ -43,6 +43,7 @@ TIFFOvrCache *TIFFCreateOvrCache(TIFF *hTIFF, toff_t nDirOffset)
{
TIFFOvrCache *psCache;
toff_t nBaseDirOffset;
+ int nRet;
psCache = (TIFFOvrCache *)_TIFFmalloc(sizeof(TIFFOvrCache));
psCache->nDirOffset = nDirOffset;
@@ -52,7 +53,9 @@ TIFFOvrCache *TIFFCreateOvrCache(TIFF *hTIFF, toff_t nDirOffset)
/* Get definition of this raster from the TIFF file itself. */
/* -------------------------------------------------------------------- */
nBaseDirOffset = TIFFCurrentDirOffset(psCache->hTIFF);
- TIFFSetSubDirectory(hTIFF, nDirOffset);
+ nRet = TIFFSetSubDirectory(hTIFF, nDirOffset);
+ (void)nRet;
+ assert(nRet == 1);
TIFFGetField(hTIFF, TIFFTAG_IMAGEWIDTH, &(psCache->nXSize));
TIFFGetField(hTIFF, TIFFTAG_IMAGELENGTH, &(psCache->nYSize));
@@ -120,7 +123,9 @@ TIFFOvrCache *TIFFCreateOvrCache(TIFF *hTIFF, toff_t nDirOffset)
psCache->nBlockOffset = 0;
- TIFFSetSubDirectory(psCache->hTIFF, nBaseDirOffset);
+ nRet = TIFFSetSubDirectory(psCache->hTIFF, nBaseDirOffset);
+ (void)nRet;
+ assert(nRet == 1);
return psCache;
}