diff options
author | Even Rouault <even.rouault@spatialys.com> | 2023-05-07 11:14:25 +0000 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2023-05-07 11:14:25 +0000 |
commit | cea60470546fcb8bc1bb937512485aae15367b5d (patch) | |
tree | 898b53d2cc911e589041926db60041b4ff61e7ae | |
parent | ba425745d6273b0a4138862de6a57a78667d13e7 (diff) | |
parent | aa2cd98b3ef5a3de745b10d810ec7e6e94868efd (diff) | |
download | libtiff-git-cea60470546fcb8bc1bb937512485aae15367b5d.tar.gz |
Merge branch 'fix_484_TIFFDirectory_32_64_bit' into 'master'
Fix 484 TIFFDirectory td_fieldsset uses unsigned long which can be 32 or 64 bits.
Closes #484
See merge request libtiff/libtiff!471
-rw-r--r-- | libtiff/tif_dir.c | 2 | ||||
-rw-r--r-- | libtiff/tif_dir.h | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c index c3a7a418..85006218 100644 --- a/libtiff/tif_dir.c +++ b/libtiff/tif_dir.c @@ -1621,7 +1621,7 @@ void TIFFFreeDirectory(TIFF *tif) TIFFDirectory *td = &tif->tif_dir; int i; - _TIFFmemset(td->td_fieldsset, 0, FIELD_SETLONGS); + _TIFFmemset(td->td_fieldsset, 0, sizeof(td->td_fieldsset)); CleanupField(td_sminsamplevalue); CleanupField(td_smaxsamplevalue); CleanupField(td_colormap[0]); diff --git a/libtiff/tif_dir.h b/libtiff/tif_dir.h index 53473fb3..9eaf22f8 100644 --- a/libtiff/tif_dir.h +++ b/libtiff/tif_dir.h @@ -70,9 +70,9 @@ typedef struct */ typedef struct { -#define FIELD_SETLONGS 4 +#define FIELDSET_ITEMS 4 /* bit vector of fields that are set */ - unsigned long td_fieldsset[FIELD_SETLONGS]; + uint32_t td_fieldsset[FIELDSET_ITEMS]; uint32_t td_imagewidth, td_imagelength, td_imagedepth; uint32_t td_tilewidth, td_tilelength, td_tiledepth; @@ -202,9 +202,9 @@ typedef struct */ #define FIELD_PSEUDO 0 -#define FIELD_LAST (32 * FIELD_SETLONGS - 1) +#define FIELD_LAST (32 * FIELDSET_ITEMS - 1) -#define BITn(n) (((unsigned long)1L) << ((n)&0x1f)) +#define BITn(n) (((uint32_t)1L) << ((n)&0x1f)) #define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32]) #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field)) #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field)) |