diff options
author | Su_Laus <sulau@freenet.de> | 2023-02-08 21:36:18 +0100 |
---|---|---|
committer | Su_Laus <sulau@freenet.de> | 2023-02-08 21:36:18 +0100 |
commit | aa2cd98b3ef5a3de745b10d810ec7e6e94868efd (patch) | |
tree | 6a89304802241f30c7ca66262aebe854dcd8bae3 | |
parent | feb8db628d38835bd9442d1fcbaf979c05487490 (diff) | |
download | libtiff-git-aa2cd98b3ef5a3de745b10d810ec7e6e94868efd.tar.gz |
Fix 484 TIFFDirectory td_fieldsset uses unsigned long which can be 32 or 64 bits.
Closes #484
-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 8c275e04..49d909d2 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 fad1eb02..ff37b2ba 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)) |