|
LibTIFF 4.7.2
TIFF library public API and implementation reference
|
Fetch, convert, validate, and recover parsed directory entries. More...
Data Structures | |
| union | _UInt64Aligned_t |
| Provide aligned scalar and byte views of eight raw bytes. More... | |
Macros | |
| #define | FAILED_FII ((uint32_t)-1) |
| Represent a missing field-table index with UINT32_MAX. | |
| #define | TIFFCvtIEEEFloatToNative(tif, n, fp) |
| Recognise already compatible float storage without conversion. | |
| #define | TIFFCvtIEEEDoubleToNative(tif, n, dp) |
| Recognise already compatible double storage without conversion. | |
| #define | INITIAL_THRESHOLD (1024 * 1024) |
| Start progressive external-tag reads at one MiB on 64-bit hosts. | |
| #define | THRESHOLD_MULTIPLIER 10 |
| Grow progressive read requests by a factor of ten. | |
| #define | MAX_THRESHOLD |
| Set the progressive read threshold cutoff to 1000 MiB. | |
| #define | MAX_SIZE_TAG_DATA 2147483647U |
| Limit source and converted tag arrays to INT32_MAX bytes. | |
Typedefs | |
| typedef union _UInt64Aligned_t | UInt64Aligned_t |
| Provide aligned scalar and byte views of eight raw bytes. | |
Enumerations | |
| enum | TIFFReadDirEntryErr { TIFFReadDirEntryErrOk = 0 , TIFFReadDirEntryErrCount = 1 , TIFFReadDirEntryErrType = 2 , TIFFReadDirEntryErrIo = 3 , TIFFReadDirEntryErrRange = 4 , TIFFReadDirEntryErrPsdif = 5 , TIFFReadDirEntryErrSizesan = 6 , TIFFReadDirEntryErrAlloc = 7 } |
| Classify directory-entry decoding failures. More... | |
Functions | |
| static uint64_t | TIFFReadUInt64 (const uint8_t *value) |
| Copy eight unaligned bytes into a native uint64_t value. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryByte (TIFF *tif, TIFFDirEntry *direntry, uint8_t *value) |
| Convert one directory value to uint8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntrySbyte (TIFF *tif, TIFFDirEntry *direntry, int8_t *value) |
| Convert one directory value to int8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryShort (TIFF *tif, TIFFDirEntry *direntry, uint16_t *value) |
| Convert one directory value to uint16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntrySshort (TIFF *tif, TIFFDirEntry *direntry, int16_t *value) |
| Convert one directory value to int16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryLong (TIFF *tif, TIFFDirEntry *direntry, uint32_t *value) |
| Convert one directory value to uint32_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntrySlong (TIFF *tif, TIFFDirEntry *direntry, int32_t *value) |
| Convert one directory value to int32_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryLong8 (TIFF *tif, TIFFDirEntry *direntry, uint64_t *value) |
| Convert one directory value to uint64_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntrySlong8 (TIFF *tif, TIFFDirEntry *direntry, int64_t *value) |
| Convert one directory value to int64_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryFloat (TIFF *tif, TIFFDirEntry *direntry, float *value) |
| Convert one directory value to float. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryDouble (TIFF *tif, TIFFDirEntry *direntry, double *value) |
| Convert one directory value to double. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryIfd8 (TIFF *tif, TIFFDirEntry *direntry, uint64_t *value) |
| Convert one directory value to uint64_t directory offset. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryDataAndRealloc (TIFF *tif, uint64_t offset, tmsize_t size, void **pdest) |
| Grow an owned buffer while reading an external value. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryArrayWithLimit (TIFF *tif, TIFFDirEntry *direntry, uint32_t *count, uint32_t desttypesize, void **value, uint64_t maxcount) |
| Fetch raw directory array bytes with checked size limits. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryArray (TIFF *tif, TIFFDirEntry *direntry, uint32_t *count, uint32_t desttypesize, void **value) |
| Fetch raw directory array bytes with checked size limits. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryByteArray (TIFF *tif, TIFFDirEntry *direntry, uint8_t **value) |
| Read a directory array as uint8_t elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntrySbyteArray (TIFF *tif, TIFFDirEntry *direntry, int8_t **value) |
| Read a directory array as int8_t elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryShortArray (TIFF *tif, TIFFDirEntry *direntry, uint16_t **value) |
| Read a directory array as uint16_t elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntrySshortArray (TIFF *tif, TIFFDirEntry *direntry, int16_t **value) |
| Read a directory array as int16_t elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryLongArray (TIFF *tif, TIFFDirEntry *direntry, uint32_t **value) |
| Read a directory array as uint32_t elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntrySlongArray (TIFF *tif, TIFFDirEntry *direntry, int32_t **value) |
| Read a directory array as int32_t elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryLong8ArrayWithLimit (TIFF *tif, TIFFDirEntry *direntry, uint64_t **value, uint64_t maxcount) |
| Read a directory array as uint64_t elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryLong8Array (TIFF *tif, TIFFDirEntry *direntry, uint64_t **value) |
| Read a directory array as uint64_t elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntrySlong8Array (TIFF *tif, TIFFDirEntry *direntry, int64_t **value) |
| Read a directory array as int64_t elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryFloatArray (TIFF *tif, TIFFDirEntry *direntry, float **value) |
| Read a directory array as float elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryDoubleArray (TIFF *tif, TIFFDirEntry *direntry, double **value) |
| Read a directory array as double elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryIfd8Array (TIFF *tif, TIFFDirEntry *direntry, uint64_t **value) |
| Read a directory array as uint64_t directory offset elements. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryPersampleShort (TIFF *tif, TIFFDirEntry *direntry, uint16_t *value) |
| Reduce equal per-sample short values to one scalar. | |
| static void | TIFFReadDirEntryCheckedByte (TIFF *tif, TIFFDirEntry *direntry, uint8_t *value) |
| Read a prevalidated uint8_t value. | |
| static void | TIFFReadDirEntryCheckedSbyte (TIFF *tif, TIFFDirEntry *direntry, int8_t *value) |
| Read a prevalidated int8_t value. | |
| static void | TIFFReadDirEntryCheckedShort (TIFF *tif, TIFFDirEntry *direntry, uint16_t *value) |
| Read a prevalidated uint16_t value. | |
| static void | TIFFReadDirEntryCheckedSshort (TIFF *tif, TIFFDirEntry *direntry, int16_t *value) |
| Read a prevalidated int16_t value. | |
| static void | TIFFReadDirEntryCheckedLong (TIFF *tif, TIFFDirEntry *direntry, uint32_t *value) |
| Read a prevalidated uint32_t value. | |
| static void | TIFFReadDirEntryCheckedSlong (TIFF *tif, TIFFDirEntry *direntry, int32_t *value) |
| Read a prevalidated int32_t value. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckedLong8 (TIFF *tif, TIFFDirEntry *direntry, uint64_t *value) |
| Read a prevalidated uint64_t value. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckedSlong8 (TIFF *tif, TIFFDirEntry *direntry, int64_t *value) |
| Read a prevalidated int64_t value. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckedSrational (TIFF *tif, TIFFDirEntry *direntry, double *value) |
| Read a prevalidated srational value. | |
| static void | TIFFReadDirEntryCheckedFloat (TIFF *tif, TIFFDirEntry *direntry, float *value) |
| Read a prevalidated float value. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckedDouble (TIFF *tif, TIFFDirEntry *direntry, double *value) |
| Read a prevalidated double value. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeByteSbyte (int8_t value) |
| Check whether int8_t fits uint8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeByteShort (uint16_t value) |
| Check whether uint16_t fits uint8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeByteSshort (int16_t value) |
| Check whether int16_t fits uint8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeByteLong (uint32_t value) |
| Check whether uint32_t fits uint8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeByteSlong (int32_t value) |
| Check whether int32_t fits uint8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeByteLong8 (uint64_t value) |
| Check whether uint64_t fits uint8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeByteSlong8 (int64_t value) |
| Check whether int64_t fits uint8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSbyteByte (uint8_t value) |
| Check whether uint8_t fits int8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSbyteShort (uint16_t value) |
| Check whether uint16_t fits int8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSbyteSshort (int16_t value) |
| Check whether int16_t fits int8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSbyteLong (uint32_t value) |
| Check whether uint32_t fits int8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSbyteSlong (int32_t value) |
| Check whether int32_t fits int8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSbyteLong8 (uint64_t value) |
| Check whether uint64_t fits int8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSbyteSlong8 (int64_t value) |
| Check whether int64_t fits int8_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeShortSbyte (int8_t value) |
| Check whether int8_t fits uint16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeShortSshort (int16_t value) |
| Check whether int16_t fits uint16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeShortLong (uint32_t value) |
| Check whether uint32_t fits uint16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeShortSlong (int32_t value) |
| Check whether int32_t fits uint16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeShortLong8 (uint64_t value) |
| Check whether uint64_t fits uint16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeShortSlong8 (int64_t value) |
| Check whether int64_t fits uint16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSshortShort (uint16_t value) |
| Check whether uint16_t fits int16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSshortLong (uint32_t value) |
| Check whether uint32_t fits int16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSshortSlong (int32_t value) |
| Check whether int32_t fits int16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSshortLong8 (uint64_t value) |
| Check whether uint64_t fits int16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSshortSlong8 (int64_t value) |
| Check whether int64_t fits int16_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeLongSbyte (int8_t value) |
| Check whether int8_t fits uint32_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeLongSshort (int16_t value) |
| Check whether int16_t fits uint32_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeLongSlong (int32_t value) |
| Check whether int32_t fits uint32_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeLongLong8 (uint64_t value) |
| Check whether uint64_t fits uint32_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeLongSlong8 (int64_t value) |
| Check whether int64_t fits uint32_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSlongLong (uint32_t value) |
| Check whether uint32_t fits int32_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSlongLong8 (uint64_t value) |
| Check whether uint64_t fits int32_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSlongSlong8 (int64_t value) |
| Check whether int64_t fits int32_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeLong8Sbyte (int8_t value) |
| Check whether int8_t fits uint64_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeLong8Sshort (int16_t value) |
| Check whether int16_t fits uint64_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeLong8Slong (int32_t value) |
| Check whether int32_t fits uint64_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeLong8Slong8 (int64_t value) |
| Check whether int64_t fits uint64_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryCheckRangeSlong8Long8 (uint64_t value) |
| Check whether uint64_t fits int64_t. | |
| static enum TIFFReadDirEntryErr | TIFFReadDirEntryData (TIFF *tif, uint64_t offset, tmsize_t size, void *dest) |
| Copy a raw external byte range into caller storage. | |
| static void | TIFFReadDirEntryOutputErr (TIFF *tif, enum TIFFReadDirEntryErr err, const char *module, const char *tagname, int recover) |
| Report a directory-entry conversion error at the requested severity. | |
| static int | _TIFFGetMaxColorChannels (uint16_t photometric) |
| Classify the expected maximum colour-channel count. | |
| static int | ByteCountLooksBad (TIFF *tif) |
| Test whether the first strip byte count needs recovery. | |
| static bool | EvaluateIFDdatasizeReading (TIFF *tif, TIFFDirEntry *dp) |
| Record the external byte range of one IFD entry. | |
| static int | cmpTIFFEntryOffsetAndLength (const void *a, const void *b) |
| Order external IFD ranges by starting byte offset. | |
| static void | CalcFinalIFDdatasizeReading (TIFF *tif, uint16_t dircount) |
| Estimate the reusable contiguous span of the loaded IFD. | |
| static void | TIFFReadDirectoryCheckOrder (TIFF *tif, TIFFDirEntry *dir, uint16_t dircount) |
| Warn if directory tags are not strictly increasing. | |
| static TIFFDirEntry * | TIFFReadDirectoryFindEntry (TIFF *tif, TIFFDirEntry *dir, uint16_t dircount, uint16_t tagid) |
| Find the first parsed entry with a given tag. | |
| static void | TIFFReadDirectoryFindFieldInfo (TIFF *tif, uint16_t tagid, uint32_t *fii) |
| Locate the first registered descriptor index for a tag. | |
| static int | EstimateStripByteCounts (TIFF *tif, TIFFDirEntry *dir, uint16_t dircount) |
| Replace missing or suspect strile byte counts with estimates. | |
| static void | MissingRequired (TIFF *tif, const char *tagname) |
| Report an absent required image tag. | |
| static int | CheckDirCount (TIFF *tif, TIFFDirEntry *dir, uint32_t count) |
| Validate or trim an entry to its expected count. | |
| static uint16_t | TIFFFetchDirectory (TIFF *tif, uint64_t diroff, TIFFDirEntry **pdir, uint64_t *nextdiroff) |
| Fetch and normalise raw classic TIFF or BigTIFF entries. | |
| static int | TIFFFetchNormalTag (TIFF *tif, TIFFDirEntry *dp, int recover) |
| Decode a parsed value according to its registered set/get representation. | |
| static int | TIFFFetchSubjectDistance (TIFF *tif, TIFFDirEntry *dir) |
| Decode EXIF SubjectDistance with its special sentinel values. | |
| enum TIFFReadDirEntryErr | _TIFFReadDirEntryCheckedRational (TIFF *tif, TIFFDirEntry *direntry, double *value) |
| Read a prevalidated rational value. | |
Fetch, convert, validate, and recover parsed directory entries.
| #define FAILED_FII ((uint32_t)-1) |
Represent a missing field-table index with UINT32_MAX.
Definition at line 54 of file tif_dirread.c.
| #define INITIAL_THRESHOLD (1024 * 1024) |
Start progressive external-tag reads at one MiB on 64-bit hosts.
Definition at line 1537 of file tif_dirread.c.
| #define MAX_SIZE_TAG_DATA 2147483647U |
Limit source and converted tag arrays to INT32_MAX bytes.
Definition at line 1645 of file tif_dirread.c.
| #define MAX_THRESHOLD |
Set the progressive read threshold cutoff to 1000 MiB.
Later reads can request the entire remaining value; this is not a maximum request size.
Definition at line 1550 of file tif_dirread.c.
| #define THRESHOLD_MULTIPLIER 10 |
Grow progressive read requests by a factor of ten.
Definition at line 1542 of file tif_dirread.c.
| #define TIFFCvtIEEEDoubleToNative | ( | tif, | |
| n, | |||
| dp | |||
| ) |
Recognise already compatible double storage without conversion.
With HAVE_IEEEFP defined this is a no-op macro: arguments are not evaluated and no state, ownership, I/O, diagnostics, or storage changes occur. Non-IEEE ports instead require the external platform hook with this name.
| [in] | tif | Ignored handle expression. |
| [in] | n | Ignored element-count expression. |
| [in,out] | dp | Ignored data-pointer expression; storage is unchanged. |
Definition at line 84 of file tif_dirread.c.
| #define TIFFCvtIEEEFloatToNative | ( | tif, | |
| n, | |||
| fp | |||
| ) |
Recognise already compatible float storage without conversion.
With HAVE_IEEEFP defined this is a no-op macro: arguments are not evaluated and no state, ownership, I/O, diagnostics, or storage changes occur. Non-IEEE ports instead require the external platform hook with this name.
| [in] | tif | Ignored handle expression. |
| [in] | n | Ignored element-count expression. |
| [in,out] | fp | Ignored data-pointer expression; storage is unchanged. |
Definition at line 70 of file tif_dirread.c.
| typedef union _UInt64Aligned_t UInt64Aligned_t |
Provide aligned scalar and byte views of eight raw bytes.
Used for unaligned-safe copies and rational/component interpretation. Owns no separate storage; file-byte swapping is performed explicitly by each consumer.
| enum TIFFReadDirEntryErr |
Classify directory-entry decoding failures.
Ok is zero; nonzero values distinguish malformed counts/types, I/O, range, per-sample inconsistency, size ceilings, and allocation failure. Most low-level converters return these for their caller to diagnose. The code alone does not guarantee unchanged outputs or handle state.
|
static |
Classify the expected maximum colour-channel count.
Pure photometric classification, not validation of a complete image. No allocation, diagnostics, state, or ownership effects.
| [in] | photometric | PHOTOMETRIC_* value. |
Definition at line 5630 of file tif_dirread.c.
References PHOTOMETRIC_CFA, PHOTOMETRIC_CIELAB, PHOTOMETRIC_ICCLAB, PHOTOMETRIC_ITULAB, PHOTOMETRIC_LOGL, PHOTOMETRIC_LOGLUV, PHOTOMETRIC_MASK, PHOTOMETRIC_MINISBLACK, PHOTOMETRIC_MINISWHITE, PHOTOMETRIC_PALETTE, PHOTOMETRIC_RGB, PHOTOMETRIC_SEPARATED, and PHOTOMETRIC_YCBCR.
Referenced by TIFFReadDirectory().
|
extern |
Read a prevalidated rational value.
Caller must already validate single-element count and type. In BigTIFF copies the eight inline entry bytes; in classic TIFF reads eight bytes from the file at the entry offset (seeking unless memory-mapped). Byte-swaps when TIFF_SWAB is set. Performs no allocation, range validation, diagnostics, or ownership transfer. Divides the unsigned numerator by the denominator in double precision; a zero numerator or denominator gives zero rather than an error. The output is written only on success.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot for the quotient. |
Definition at line 4426 of file tif_dirread.c.
References _UInt64Aligned_t::i, _UInt64Aligned_t::l, TIFFDirEntry::tdir_offset, tiff::tif_flags, TIFF_BIGTIFF, TIFF_SWAB, TIFFReadDirEntryData(), TIFFReadDirEntryErrOk, TIFFSwabArrayOfLong(), TIFFSwabLong(), TIFFDirEntry::toff_long, and TIFFDirEntry::toff_long8.
Referenced by TIFFReadDirEntryDouble(), and TIFFReadDirEntryFloat().
|
static |
Test whether the first strip byte count needs recovery.
Used for the reader's single-strip heuristic. Loads offset/count if deferred and may allocate or perform I/O. A zero offset is treated as inconclusive, not bad. Nonzero-offset zero count is bad; uncompressed counts are checked against file remainder and, in read-only mode, full-image row size with overflow detection. Does not repair values or transfer ownership.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
Definition at line 5671 of file tif_dirread.c.
References COMPRESSION_NONE, TIFFDirectory::td_compression, TIFFDirectory::td_imagelength, tiff::tif_dir, tiff::tif_mode, TIFFGetFileSize, TIFFGetStrileByteCount(), TIFFGetStrileOffset(), and TIFFScanlineSize64().
Referenced by TIFFReadDirectory().
|
static |
Estimate the reusable contiguous span of the loaded IFD.
No-op for read-only mode. Otherwise sorts collected range bookkeeping and counts data contiguous after entry space, allowing selected one-byte padding gaps. May seek to EOF; exact end-of-file adjacency records UINT64_MAX to permit extension. Updates td_dirdatasize_read without allocating or transferring ownership. This is a placement heuristic, not general file-layout validation; seek failure has no separate status.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | dircount | Fetched number of entries used to compute classic/BigTIFF entry space. |
Definition at line 5835 of file tif_dirread.c.
References cmpTIFFEntryOffsetAndLength(), TIFFEntryOffsetAndLength::length, TIFFEntryOffsetAndLength::offset, TIFFDirectory::td_dirdatasize_Noffsets, TIFFDirectory::td_dirdatasize_offsets, TIFFDirectory::td_dirdatasize_read, tiff::tif_dir, tiff::tif_diroff, tiff::tif_flags, tiff::tif_mode, tiff::tif_nextdiroff, TIFF_BIGTIFF, and TIFFSeekFile.
Referenced by TIFFReadCustomDirectory(), and TIFFReadDirectory().
|
static |
Validate or trim an entry to its expected count.
A short entry warns and fails without trimming. An excessive count warns, is reduced in the parsed entry, and succeeds. Exact counts succeed silently. Does not fetch data, allocate, or transfer ownership.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in,out] | dir | Non-NULL parsed entry whose count may be reduced. |
| [in] | count | Expected element count. |
Definition at line 7839 of file tif_dirread.c.
References _TIFFField::field_name, TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_tag, tiff::tif_name, TIFFFieldWithTag(), and TIFFWarningExtR().
Referenced by TIFFReadCustomDirectory().
|
static |
Order external IFD ranges by starting byte offset.
qsort comparator; borrows two live ranges without allocation, mutation, diagnostics, or ownership transfer. Equal offsets compare equal regardless of lengths.
| [in] | a | Non-NULL left TIFFEntryOffsetAndLength pointer. |
| [in] | b | Non-NULL right TIFFEntryOffsetAndLength pointer. |
Definition at line 5799 of file tif_dirread.c.
References TIFFEntryOffsetAndLength::offset.
Referenced by CalcFinalIFDdatasizeReading().
|
static |
Replace missing or suspect strile byte counts with estimates.
Requires established nonzero strile geometry and valid offset entries. Loads offsets, possibly clears deferred entries, frees the previous count array, and allocates a replacement. Estimates compressed extents from file/IFD space, or uncompressed tile/row sizes, then marks byte-count presence and may default RowsPerStrip. Estimates are heuristics and may be partial on failure. Some overflow failures return silently; allocator/unknown-type/file-size rejection can diagnose. New arrays remain directory-owned; old borrowed views are invalidated.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | dir | Borrowed raw entry array used to estimate indirect metadata space. |
| [in] | dircount | Number of parsed entries. |
Definition at line 7299 of file tif_dirread.c.
References _TIFFCheckMalloc(), _TIFFFillStrilesInternal(), _TIFFfreeExt(), COMPRESSION_NONE, FIELD_ROWSPERSTRIP, FIELD_STRIPBYTECOUNTS, isTiled, PLANARCONFIG_SEPARATE, TIFFDirectory::td_compression, TIFFDirectory::td_imagelength, TIFFDirectory::td_nstrips, TIFFDirectory::td_planarconfig, TIFFDirectory::td_rowsperstrip, TIFFDirectory::td_samplesperpixel, TIFFDirectory::td_stripbytecount_p, TIFFDirectory::td_stripoffset_p, TIFFDirectory::td_stripsperimage, tiff::tif_dir, tiff::tif_flags, TIFF_BIGTIFF, TIFFDataWidth(), TIFFErrorExtR(), TIFFFieldSet, TIFFGetFileSize, TIFFScanlineSize64(), TIFFSetFieldBit, TIFFTileSize64(), and TIFFWarningExtR().
Referenced by TIFFReadDirectory().
|
static |
Record the external byte range of one IFD entry.
Checks multiplication and accumulation overflow and diagnoses rejection. Caller must supply sufficient td_dirdatasize_offsets capacity. Records only data exceeding inline width; normalises its raw offset and advances range/count bookkeeping. Does not allocate/read the payload or change the input entry. Failure has no general rollback of existing bookkeeping.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | dp | Non-NULL parsed borrowed entry. |
Definition at line 5733 of file tif_dirread.c.
References TIFFEntryOffsetAndLength::length, TIFFEntryOffsetAndLength::offset, TIFFDirectory::td_dirdatasize_Noffsets, TIFFDirectory::td_dirdatasize_offsets, TIFFDirectory::td_dirdatasize_read, TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_offset, TIFFDirEntry::tdir_type, tiff::tif_dir, tiff::tif_flags, TIFF_BIGTIFF, TIFF_SWAB, TIFFDataWidth(), TIFFErrorExtR(), TIFFSwabLong(), TIFFSwabLong8(), TIFFDirEntry::toff_long, and TIFFDirEntry::toff_long8.
Referenced by TIFFFetchNormalTag(), and TIFFReadDirectory().
|
static |
Report an absent required image tag.
Dispatches an error using a borrowed name. Does not supply a default, alter state, terminate, or transfer ownership.
| [in] | tif | Non-NULL handle; used only to dispatch diagnostics. |
| [in] | tagname | Non-NULL null-terminated tag name. |
Definition at line 7449 of file tif_dirread.c.
References TIFFErrorExtR().
Referenced by TIFFReadDirectory().
|
static |
Fetch and normalise raw classic TIFF or BigTIFF entries.
Sets the current offset immediately and optional next-link output to zero before fetching. Rejects counts above 4096, empty directories, invalid extents, and allocation/I/O failures; diagnostics vary by path. Missing/truncated trailing next-link bytes are accepted as zero. Uses mapped storage or client seek/read, allocates temporary raw bytes and final entries, and normalises tag/type/count while leaving offset/inline bytes raw for consumers. Frees temporary storage on detected failure, does not install tag values, and does not roll back handle/next-link state. Only success transfers the final Ext allocation; caller frees it with _TIFFfreeExt(tif,...).
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | diroff | IFD offset in file bytes. |
| [out] | pdir | Non-NULL empty owner slot; assigned only when entries are successfully fetched. |
| [out] | nextdiroff | Optional next-link output; initially zero and may change even if later work fails. |
Definition at line 7895 of file tif_dirread.c.
References _TIFFCheckMalloc(), _TIFFfreeExt(), _TIFFmemcpy(), FALSE, isMapped, ReadOK, SeekOK, TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_ignore, TIFFDirEntry::tdir_offset, TIFFDirEntry::tdir_tag, TIFFDirEntry::tdir_type, tiff::tif_base, tiff::tif_diroff, tiff::tif_flags, tiff::tif_name, tiff::tif_size, TIFF_BIGTIFF, TIFF_SWAB, TIFFErrorExtR(), TIFFGetFileSize, TIFFReadUInt64(), TIFFSwabLong(), TIFFSwabLong8(), TIFFSwabShort(), TIFFWarningExtR(), and TIFFDirEntry::toff_long8.
Referenced by TIFFReadCustomDirectory(), and TIFFReadDirectory().
|
static |
Decode a parsed value according to its registered set/get representation.
Requires a matching descriptor and representation/count/passcount invariants; OTHER, INT, and C0_ASCII are not generic stored-tag cases. Allocates conversion buffers, can repair/terminate ASCII, then calls TIFFSetField() with representation-specific arguments. Temporary arrays are released after dispatch; setters must copy rather than retain them. Changes values/codec/dirty state without rollback. recover selects warning severity but conversion failure still returns zero; the parent decides whether to ignore it. UNDEFINED representation reports an error and skips the value yet returns one because the local conversion code remains Ok. Diagnostics can come from both converter and setter.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | dp | Non-NULL parsed borrowed entry; count/type must match the selected representation. |
| [in] | recover | Nonzero for ignored-tag warning severity, zero for error severity; does not change failed conversion to success. |
Definition at line 8217 of file tif_dirread.c.
References _TIFFfreeExt(), _TIFFmallocExt(), _TIFFmemcpy(), EvaluateIFDdatasizeReading(), FAILED_FII, _TIFFField::field_name, _TIFFField::field_passcount, _TIFFField::field_readcount, _TIFFField::field_tag, _TIFFField::set_get_field_type, TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_tag, TIFFDirEntry::tdir_type, tiff::tif_fields, tiff::tif_flags, TIFF_LONG, TIFF_SETGET_ASCII, TIFF_SETGET_C0_ASCII, TIFF_SETGET_C0_DOUBLE, TIFF_SETGET_C0_FLOAT, TIFF_SETGET_C0_IFD8, TIFF_SETGET_C0_SINT16, TIFF_SETGET_C0_SINT32, TIFF_SETGET_C0_SINT64, TIFF_SETGET_C0_SINT8, TIFF_SETGET_C0_UINT16, TIFF_SETGET_C0_UINT32, TIFF_SETGET_C0_UINT64, TIFF_SETGET_C0_UINT8, TIFF_SETGET_C16_ASCII, TIFF_SETGET_C16_DOUBLE, TIFF_SETGET_C16_FLOAT, TIFF_SETGET_C16_IFD8, TIFF_SETGET_C16_SINT16, TIFF_SETGET_C16_SINT32, TIFF_SETGET_C16_SINT64, TIFF_SETGET_C16_SINT8, TIFF_SETGET_C16_UINT16, TIFF_SETGET_C16_UINT32, TIFF_SETGET_C16_UINT64, TIFF_SETGET_C16_UINT8, TIFF_SETGET_C32_ASCII, TIFF_SETGET_C32_DOUBLE, TIFF_SETGET_C32_FLOAT, TIFF_SETGET_C32_IFD8, TIFF_SETGET_C32_SINT16, TIFF_SETGET_C32_SINT32, TIFF_SETGET_C32_SINT64, TIFF_SETGET_C32_SINT8, TIFF_SETGET_C32_UINT16, TIFF_SETGET_C32_UINT32, TIFF_SETGET_C32_UINT64, TIFF_SETGET_C32_UINT8, TIFF_SETGET_DOUBLE, TIFF_SETGET_FLOAT, TIFF_SETGET_IFD8, TIFF_SETGET_INT, TIFF_SETGET_OTHER, TIFF_SETGET_SINT16, TIFF_SETGET_SINT32, TIFF_SETGET_SINT64, TIFF_SETGET_SINT8, TIFF_SETGET_UINT16, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UINT32, TIFF_SETGET_UINT64, TIFF_SETGET_UINT8, TIFF_SETGET_UNDEFINED, TIFF_SWAB, TIFF_VARIABLE, TIFF_VARIABLE2, TIFFErrorExtR(), TIFFReadDirectoryFindFieldInfo(), TIFFReadDirEntryArray(), TIFFReadDirEntryByte(), TIFFReadDirEntryByteArray(), TIFFReadDirEntryDouble(), TIFFReadDirEntryDoubleArray(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, TIFFReadDirEntryFloat(), TIFFReadDirEntryFloatArray(), TIFFReadDirEntryIfd8(), TIFFReadDirEntryIfd8Array(), TIFFReadDirEntryLong(), TIFFReadDirEntryLong8(), TIFFReadDirEntryLong8Array(), TIFFReadDirEntryLongArray(), TIFFReadDirEntryOutputErr(), TIFFReadDirEntrySbyte(), TIFFReadDirEntrySbyteArray(), TIFFReadDirEntryShort(), TIFFReadDirEntryShortArray(), TIFFReadDirEntrySlong(), TIFFReadDirEntrySlong8(), TIFFReadDirEntrySlong8Array(), TIFFReadDirEntrySlongArray(), TIFFReadDirEntrySshort(), TIFFReadDirEntrySshortArray(), TIFFSetField(), TIFFSwabArrayOfLong(), TIFFTAG_RICHTIFFIPTC, and TIFFWarningExtR().
Referenced by TIFFReadCustomDirectory(), and TIFFReadDirectory().
|
static |
Decode EXIF SubjectDistance with its special sentinel values.
Requires the EXIF schema to be active. Checks one RATIONAL, reads raw components, and uses zero for a zero numerator, minus one for UINT32_MAX numerator or zero denominator, otherwise their quotient. Dispatches through TIFFSetField(); no new ownership is exposed. Failed conversion warns and returns zero; setter effects/diagnostics and partial failure rules still apply. Classic TIFF access can change I/O position.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | dir | Non-NULL parsed SubjectDistance entry. |
Definition at line 9742 of file tif_dirread.c.
References _UInt64Aligned_t::i, _UInt64Aligned_t::l, TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_offset, TIFFDirEntry::tdir_tag, TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_BIGTIFF, TIFF_RATIONAL, TIFF_SWAB, TIFFReadDirEntryData(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFReadDirEntryOutputErr(), TIFFSetField(), TIFFSwabArrayOfLong(), TIFFSwabLong(), TIFFDirEntry::toff_long8, and TRUE.
Referenced by TIFFReadCustomDirectory().
|
static |
Warn if directory tags are not strictly increasing.
Checks a borrowed array in place without sorting or marking duplicates. Emits at most one order warning; equal adjacent tags also trigger it. No allocation or ownership transfer.
| [in] | tif | Non-NULL handle; used only to dispatch diagnostics. |
| [in] | dir | Readable borrowed array of dircount parsed entries. |
| [in] | dircount | Number of entries. |
Definition at line 6898 of file tif_dirread.c.
References TIFFDirEntry::tdir_tag, and TIFFWarningExtR().
Referenced by TIFFReadCustomDirectory(), and TIFFReadDirectory().
|
static |
Find the first parsed entry with a given tag.
Linear search without allocation, mutation, I/O, or diagnostics. The tif argument is unused. Does not filter tdir_ignore or verify type/count.
| [in] | tif | Unused. |
| [in] | dir | Readable borrowed entry array. |
| [in] | dircount | Number of entries. |
| [in] | tagid | On-disk tag number. |
Definition at line 6933 of file tif_dirread.c.
References TIFFDirEntry::tdir_tag.
Referenced by TIFFReadDirectory().
|
static |
Locate the first registered descriptor index for a tag.
Binary-searches a valid tag-sorted handle table, then backs up over equal tag numbers. Does not validate the file type, allocate, issue diagnostics, or transfer ownership. Caller must keep the table stable during the search.
| [in] | tif | Non-NULL handle whose tif_fields table is searched; not modified. |
| [in] | tagid | On-disk tag number. |
| [out] | fii | Non-NULL slot for the first descriptor index or FAILED_FII. |
Definition at line 6963 of file tif_dirread.c.
References FAILED_FII, _TIFFField::field_tag, tiff::tif_fields, and tiff::tif_nfields.
Referenced by TIFFFetchNormalTag(), TIFFReadCustomDirectory(), and TIFFReadDirectory().
|
static |
Fetch raw directory array bytes with checked size limits.
Copies bytes without element swapping/conversion, preserving the original entry. Applies the MAX_SIZE_TAG_DATA ceiling to source and destination element products and large-request/file-size checks. Uses inline bytes or external I/O; may allocate progressively. Empty/unknown-width data succeeds with *value NULL without setting count. Successful nonempty storage belongs to the caller and must be freed with _TIFFfreeExt(tif,...); supply no prior owned allocation. Temporary data is freed on detected read failure. Delegates to the limited variant with UINT64_MAX maximum. May seek and read when not memory-mapped. The oversized-request check warns and allocation failures are diagnosed; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | count | Non-NULL element-count slot; assigned before some later failures, and not assigned on the zero/unknown-width success path. |
| [in] | desttypesize | Positive intended output element width used for the size ceiling, not conversion. |
| [out] | value | Non-NULL empty owner slot; success supplies a new matching Ext allocation or NULL; errors do not uniformly initialise it. |
Definition at line 1835 of file tif_dirread.c.
References TIFFReadDirEntryArrayWithLimit().
Referenced by TIFFFetchNormalTag(), TIFFReadDirEntryByteArray(), TIFFReadDirEntryDoubleArray(), TIFFReadDirEntryFloatArray(), TIFFReadDirEntryIfd8Array(), TIFFReadDirEntryLongArray(), TIFFReadDirEntrySbyteArray(), TIFFReadDirEntryShortArray(), TIFFReadDirEntrySlong8Array(), TIFFReadDirEntrySlongArray(), and TIFFReadDirEntrySshortArray().
|
static |
Fetch raw directory array bytes with checked size limits.
Copies bytes without element swapping/conversion, preserving the original entry. Applies the MAX_SIZE_TAG_DATA ceiling to source and destination element products and large-request/file-size checks. Uses inline bytes or external I/O; may allocate progressively. Empty/unknown-width data succeeds with *value NULL without setting count. Successful nonempty storage belongs to the caller and must be freed with _TIFFfreeExt(tif,...); supply no prior owned allocation. Temporary data is freed on detected read failure. May seek and read when not memory-mapped. The oversized-request check warns and allocation failures are diagnosed; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | count | Non-NULL element-count slot; assigned before some later failures, and not assigned on the zero/unknown-width success path. |
| [in] | desttypesize | Positive intended output element width used for the size ceiling, not conversion. |
| [out] | value | Non-NULL empty owner slot; success supplies a new matching Ext allocation or NULL; errors do not uniformly initialise it. |
| [in] | maxcount | Maximum elements to fetch; original count still determines inline/external placement. |
Definition at line 1678 of file tif_dirread.c.
References _TIFFCheckMalloc(), _TIFFfreeExt(), _TIFFmemcpy(), isMapped, MAX_SIZE_TAG_DATA, TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_offset, TIFFDirEntry::tdir_tag, TIFFDirEntry::tdir_type, tiff::tif_flags, tiff::tif_size, TIFF_BIGTIFF, TIFF_SWAB, TIFFDataWidth(), TIFFGetFileSize, TIFFReadDirEntryData(), TIFFReadDirEntryDataAndRealloc(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrIo, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrSizesan, TIFFSwabLong(), TIFFSwabLong8(), TIFFWarningExtR(), TIFFDirEntry::toff_long, and TIFFDirEntry::toff_long8.
Referenced by TIFFReadDirEntryArray(), and TIFFReadDirEntryLong8ArrayWithLimit().
|
static |
Convert one directory value to uint8_t.
Requires count exactly one. Accepts TIFF_BYTE, TIFF_UNDEFINED, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. TIFF_BYTE and TIFF_UNDEFINED are copied; every other type is rejected with TIFFReadDirEntryErrRange unless the value is in 0..UINT8_MAX. TIFF_LONG8 and TIFF_SLONG8 values are read from the file at the entry offset in classic TIFF (seeking unless memory-mapped) and from the inline entry bytes in BigTIFF; all other accepted types are inline. Performs no allocation and emits no diagnostics itself; errors are returned for the caller to report. *value is written only on success, except that an I/O failure can leave it partially written when it is the read destination.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned scalar slot; valid only on TIFFReadDirEntryErrOk. |
Definition at line 394 of file tif_dirread.c.
References TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_type, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFF_UNDEFINED, TIFFReadDirEntryCheckedByte(), TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSbyte(), TIFFReadDirEntryCheckedShort(), TIFFReadDirEntryCheckedSlong(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryCheckedSshort(), TIFFReadDirEntryCheckRangeByteLong(), TIFFReadDirEntryCheckRangeByteLong8(), TIFFReadDirEntryCheckRangeByteSbyte(), TIFFReadDirEntryCheckRangeByteShort(), TIFFReadDirEntryCheckRangeByteSlong(), TIFFReadDirEntryCheckRangeByteSlong8(), TIFFReadDirEntryCheckRangeByteSshort(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrType.
Referenced by TIFFFetchNormalTag().
|
static |
Read a directory array as uint8_t elements.
Accepts TIFF_ASCII, TIFF_UNDEFINED, TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. Fetches the raw elements with TIFFReadDirEntryArray() (inline bytes, or file data that may be sought and read when not memory-mapped) and swaps them to host order. TIFF_ASCII, TIFF_UNDEFINED and TIFF_BYTE are returned as fetched; TIFF_SBYTE is range-checked in place. Wider types are converted into a new array. Any element outside 0..UINT8_MAX fails with TIFFReadDirEntryErrRange. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL. An existing allocation in *value is not freed. *value is set to NULL when the raw fetch fails; type, allocation and range errors leave it unchanged. Temporary buffers are freed on every error path. The oversized-request check and allocation failures emit diagnostics; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
Definition at line 1870 of file tif_dirread.c.
References _TIFFfreeExt(), _TIFFmallocExt(), TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_ASCII, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFF_SWAB, TIFF_UNDEFINED, TIFFReadDirEntryArray(), TIFFReadDirEntryCheckRangeByteLong(), TIFFReadDirEntryCheckRangeByteLong8(), TIFFReadDirEntryCheckRangeByteSbyte(), TIFFReadDirEntryCheckRangeByteShort(), TIFFReadDirEntryCheckRangeByteSlong(), TIFFReadDirEntryCheckRangeByteSlong8(), TIFFReadDirEntryCheckRangeByteSshort(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFSwabLong(), TIFFSwabLong8(), and TIFFSwabShort().
Referenced by TIFFFetchNormalTag().
|
static |
Read a prevalidated uint8_t value.
Caller must already validate single-element count/type and inline storage. Copies the first inline entry byte; no byte swapping applies. Performs no allocation, I/O, diagnostics, range validation, or ownership transfer. The Checked name denotes caller-established preconditions.
| [in] | tif | Unused. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot of the matching representation. |
Definition at line 4219 of file tif_dirread.c.
References TIFFDirEntry::tdir_offset.
Referenced by TIFFReadDirEntryByte(), TIFFReadDirEntryDouble(), TIFFReadDirEntryFloat(), TIFFReadDirEntryLong(), TIFFReadDirEntryLong8(), TIFFReadDirEntrySbyte(), TIFFReadDirEntryShort(), TIFFReadDirEntrySlong(), TIFFReadDirEntrySlong8(), and TIFFReadDirEntrySshort().
|
static |
Read a prevalidated double value.
Caller must already validate single-element count and type. In BigTIFF copies the eight inline entry bytes; in classic TIFF reads eight bytes from the file at the entry offset with TIFFReadDirEntryData() (seeking unless memory-mapped). Byte-swaps when TIFF_SWAB is set. Performs no allocation, range validation, diagnostics, or ownership transfer. A classic TIFF read failure can leave the output partially written; use it only on success.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot of the matching representation. |
Definition at line 4629 of file tif_dirread.c.
References _UInt64Aligned_t::d, _UInt64Aligned_t::l, TIFFDirEntry::tdir_offset, tiff::tif_flags, TIFF_BIGTIFF, TIFF_SWAB, TIFFReadDirEntryData(), TIFFReadDirEntryErrOk, TIFFSwabLong(), TIFFSwabLong8(), TIFFDirEntry::toff_long, and TIFFDirEntry::toff_long8.
Referenced by TIFFReadDirEntryDouble(), and TIFFReadDirEntryFloat().
|
static |
Read a prevalidated float value.
Caller must already validate single-element count/type and inline storage. Copies the leading inline entry bytes and byte-swaps the result when TIFF_SWAB is set. Performs no allocation, I/O, diagnostics, range validation, or ownership transfer. The Checked name denotes caller-established preconditions.
| [in] | tif | Non-NULL handle; only TIFF_SWAB in tif_flags is read. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot of the matching representation. |
Definition at line 4591 of file tif_dirread.c.
References TIFFDirEntry::tdir_offset, tiff::tif_flags, TIFF_SWAB, and TIFFSwabLong().
Referenced by TIFFReadDirEntryDouble(), and TIFFReadDirEntryFloat().
|
static |
Read a prevalidated uint32_t value.
Caller must already validate single-element count/type and inline storage. Copies the leading inline entry bytes and byte-swaps the result when TIFF_SWAB is set. Performs no allocation, I/O, diagnostics, range validation, or ownership transfer. The Checked name denotes caller-established preconditions.
| [in] | tif | Non-NULL handle; only TIFF_SWAB in tif_flags is read. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot of the matching representation. |
Definition at line 4313 of file tif_dirread.c.
References TIFFDirEntry::tdir_offset, tiff::tif_flags, TIFF_SWAB, and TIFFSwabLong().
Referenced by TIFFReadDirEntryByte(), TIFFReadDirEntryDouble(), TIFFReadDirEntryFloat(), TIFFReadDirEntryIfd8(), TIFFReadDirEntryLong(), TIFFReadDirEntryLong8(), TIFFReadDirEntrySbyte(), TIFFReadDirEntryShort(), TIFFReadDirEntrySlong(), TIFFReadDirEntrySlong8(), and TIFFReadDirEntrySshort().
|
static |
Read a prevalidated uint64_t value.
Caller must already validate single-element count and type. In BigTIFF copies the eight inline entry bytes; in classic TIFF reads eight bytes from the file at the entry offset with TIFFReadDirEntryData() (seeking unless memory-mapped). Byte-swaps when TIFF_SWAB is set. Performs no allocation, range validation, diagnostics, or ownership transfer. A classic TIFF read failure can leave the output partially written; use it only on success.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot of the matching representation. |
Definition at line 4366 of file tif_dirread.c.
References TIFFDirEntry::tdir_offset, tiff::tif_flags, TIFF_BIGTIFF, TIFF_SWAB, TIFFReadDirEntryData(), TIFFReadDirEntryErrOk, TIFFSwabLong(), TIFFSwabLong8(), TIFFDirEntry::toff_long, and TIFFDirEntry::toff_long8.
Referenced by TIFFReadDirEntryByte(), TIFFReadDirEntryDouble(), TIFFReadDirEntryFloat(), TIFFReadDirEntryIfd8(), TIFFReadDirEntryLong(), TIFFReadDirEntryLong8(), TIFFReadDirEntrySbyte(), TIFFReadDirEntryShort(), TIFFReadDirEntrySlong(), TIFFReadDirEntrySlong8(), and TIFFReadDirEntrySshort().
|
static |
Read a prevalidated int8_t value.
Caller must already validate single-element count/type and inline storage. Copies the first inline entry byte; no byte swapping applies. Performs no allocation, I/O, diagnostics, range validation, or ownership transfer. The Checked name denotes caller-established preconditions.
| [in] | tif | Unused. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot of the matching representation. |
Definition at line 4241 of file tif_dirread.c.
References TIFFDirEntry::tdir_offset.
Referenced by TIFFReadDirEntryByte(), TIFFReadDirEntryDouble(), TIFFReadDirEntryFloat(), TIFFReadDirEntryLong(), TIFFReadDirEntryLong8(), TIFFReadDirEntrySbyte(), TIFFReadDirEntryShort(), TIFFReadDirEntrySlong(), TIFFReadDirEntrySlong8(), and TIFFReadDirEntrySshort().
|
static |
Read a prevalidated uint16_t value.
Caller must already validate single-element count/type and inline storage. Copies the leading inline entry bytes and byte-swaps the result when TIFF_SWAB is set. Performs no allocation, I/O, diagnostics, range validation, or ownership transfer. The Checked name denotes caller-established preconditions.
| [in] | tif | Non-NULL handle; only TIFF_SWAB in tif_flags is read. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot of the matching representation. |
Definition at line 4264 of file tif_dirread.c.
References TIFFDirEntry::tdir_offset, tiff::tif_flags, TIFF_SWAB, TIFFSwabShort(), and TIFFDirEntry::toff_short.
Referenced by TIFFReadDirEntryByte(), TIFFReadDirEntryDouble(), TIFFReadDirEntryFloat(), TIFFReadDirEntryLong(), TIFFReadDirEntryLong8(), TIFFReadDirEntrySbyte(), TIFFReadDirEntryShort(), TIFFReadDirEntrySlong(), TIFFReadDirEntrySlong8(), and TIFFReadDirEntrySshort().
|
static |
Read a prevalidated int32_t value.
Caller must already validate single-element count/type and inline storage. Copies the leading inline entry bytes and byte-swaps the result when TIFF_SWAB is set. Performs no allocation, I/O, diagnostics, range validation, or ownership transfer. The Checked name denotes caller-established preconditions.
| [in] | tif | Non-NULL handle; only TIFF_SWAB in tif_flags is read. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot of the matching representation. |
Definition at line 4337 of file tif_dirread.c.
References TIFFDirEntry::tdir_offset, tiff::tif_flags, TIFF_SWAB, and TIFFSwabLong().
Referenced by TIFFReadDirEntryByte(), TIFFReadDirEntryDouble(), TIFFReadDirEntryFloat(), TIFFReadDirEntryLong(), TIFFReadDirEntryLong8(), TIFFReadDirEntrySbyte(), TIFFReadDirEntryShort(), TIFFReadDirEntrySlong(), TIFFReadDirEntrySlong8(), and TIFFReadDirEntrySshort().
|
static |
Read a prevalidated int64_t value.
Caller must already validate single-element count and type. In BigTIFF copies the eight inline entry bytes; in classic TIFF reads eight bytes from the file at the entry offset with TIFFReadDirEntryData() (seeking unless memory-mapped). Byte-swaps when TIFF_SWAB is set. Performs no allocation, range validation, diagnostics, or ownership transfer. A classic TIFF read failure can leave the output partially written; use it only on success.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot of the matching representation. |
Definition at line 4406 of file tif_dirread.c.
References TIFFDirEntry::tdir_offset, tiff::tif_flags, TIFF_BIGTIFF, TIFF_SWAB, TIFFReadDirEntryData(), TIFFReadDirEntryErrOk, TIFFSwabLong(), TIFFSwabLong8(), and TIFFDirEntry::toff_long.
Referenced by TIFFReadDirEntryByte(), TIFFReadDirEntryDouble(), TIFFReadDirEntryFloat(), TIFFReadDirEntryLong(), TIFFReadDirEntryLong8(), TIFFReadDirEntrySbyte(), TIFFReadDirEntryShort(), TIFFReadDirEntrySlong(), TIFFReadDirEntrySlong8(), and TIFFReadDirEntrySshort().
|
static |
Read a prevalidated srational value.
Caller must already validate single-element count and type. In BigTIFF copies the eight inline entry bytes; in classic TIFF reads eight bytes from the file at the entry offset with TIFFReadDirEntryData() (seeking unless memory-mapped). Byte-swaps when TIFF_SWAB is set. Performs no allocation, range validation, diagnostics, or ownership transfer. Divides the signed 32-bit numerator by the unsigned denominator in double precision; a zero numerator or denominator gives zero. The output is written only on success.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot of the matching representation. |
Definition at line 4480 of file tif_dirread.c.
References _UInt64Aligned_t::i, _UInt64Aligned_t::l, TIFFDirEntry::tdir_offset, tiff::tif_flags, TIFF_BIGTIFF, TIFF_SWAB, TIFFReadDirEntryData(), TIFFReadDirEntryErrOk, TIFFSwabArrayOfLong(), TIFFSwabLong(), TIFFDirEntry::toff_long, and TIFFDirEntry::toff_long8.
Referenced by TIFFReadDirEntryDouble(), and TIFFReadDirEntryFloat().
|
static |
Read a prevalidated int16_t value.
Caller must already validate single-element count/type and inline storage. Copies the leading inline entry bytes and byte-swaps the result when TIFF_SWAB is set. Performs no allocation, I/O, diagnostics, range validation, or ownership transfer. The Checked name denotes caller-established preconditions.
| [in] | tif | Non-NULL handle; only TIFF_SWAB in tif_flags is read. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned output slot of the matching representation. |
Definition at line 4289 of file tif_dirread.c.
References TIFFDirEntry::tdir_offset, tiff::tif_flags, TIFF_SWAB, and TIFFSwabShort().
Referenced by TIFFReadDirEntryByte(), TIFFReadDirEntryDouble(), TIFFReadDirEntryFloat(), TIFFReadDirEntryLong(), TIFFReadDirEntryLong8(), TIFFReadDirEntrySbyte(), TIFFReadDirEntryShort(), TIFFReadDirEntrySlong(), TIFFReadDirEntrySlong8(), and TIFFReadDirEntrySshort().
|
static |
Check whether uint32_t fits uint8_t.
Rejects when value > 0xFF. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4731 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryByte(), and TIFFReadDirEntryByteArray().
|
static |
Check whether uint64_t fits uint8_t.
Rejects when value > 0xFF. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4773 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryByte(), and TIFFReadDirEntryByteArray().
|
static |
Check whether int8_t fits uint8_t.
Rejects when value < 0. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4668 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryByte(), and TIFFReadDirEntryByteArray().
|
static |
Check whether uint16_t fits uint8_t.
Rejects when value > 0xFF. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4689 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryByte(), and TIFFReadDirEntryByteArray().
|
static |
Check whether int32_t fits uint8_t.
Rejects when (value < 0) || (value > 0xFF). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4752 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryByte(), and TIFFReadDirEntryByteArray().
|
static |
Check whether int64_t fits uint8_t.
Rejects when (value < 0) || (value > 0xFF). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4794 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryByte(), and TIFFReadDirEntryByteArray().
|
static |
Check whether int16_t fits uint8_t.
Rejects when (value < 0) || (value > 0xFF). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4710 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryByte(), and TIFFReadDirEntryByteArray().
|
static |
Check whether int8_t fits uint64_t.
Rejects when value < 0. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5364 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryLong8(), and TIFFReadDirEntryLong8ArrayWithLimit().
|
static |
Check whether int32_t fits uint64_t.
Rejects when value < 0. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5406 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryLong8(), and TIFFReadDirEntryLong8ArrayWithLimit().
|
static |
Check whether int64_t fits uint64_t.
Rejects when value < 0. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5427 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryLong8(), and TIFFReadDirEntryLong8ArrayWithLimit().
|
static |
Check whether int16_t fits uint64_t.
Rejects when value < 0. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5385 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryLong8(), and TIFFReadDirEntryLong8ArrayWithLimit().
|
static |
Check whether uint64_t fits uint32_t.
Rejects when value > UINT32_MAX. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5256 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryLong(), and TIFFReadDirEntryLongArray().
|
static |
Check whether int8_t fits uint32_t.
Rejects when value < 0. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5193 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryLong(), and TIFFReadDirEntryLongArray().
|
static |
Check whether int32_t fits uint32_t.
Rejects when value < 0. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5235 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryLong(), and TIFFReadDirEntryLongArray().
|
static |
Check whether int64_t fits uint32_t.
Rejects when (value < 0) || (value > (int64_t)UINT32_MAX). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5277 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryLong(), and TIFFReadDirEntryLongArray().
|
static |
Check whether int16_t fits uint32_t.
Rejects when value < 0. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5214 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryLong(), and TIFFReadDirEntryLongArray().
|
static |
Check whether uint8_t fits int8_t.
Rejects when value > 0x7F. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4815 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySbyte(), and TIFFReadDirEntrySbyteArray().
|
static |
Check whether uint32_t fits int8_t.
Rejects when value > 0x7F. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4878 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySbyte(), and TIFFReadDirEntrySbyteArray().
|
static |
Check whether uint64_t fits int8_t.
Rejects when value > 0x7F. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4920 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySbyte(), and TIFFReadDirEntrySbyteArray().
|
static |
Check whether uint16_t fits int8_t.
Rejects when value > 0x7F. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4836 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySbyte(), and TIFFReadDirEntrySbyteArray().
|
static |
Check whether int32_t fits int8_t.
Rejects when (value < -0x80) || (value > 0x7F). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4899 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySbyte(), and TIFFReadDirEntrySbyteArray().
|
static |
Check whether int64_t fits int8_t.
Rejects when (value < -0x80) || (value > 0x7F). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4941 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySbyte(), and TIFFReadDirEntrySbyteArray().
|
static |
Check whether int16_t fits int8_t.
Rejects when (value < -0x80) || (value > 0x7F). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4857 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySbyte(), and TIFFReadDirEntrySbyteArray().
|
static |
Check whether uint32_t fits uint16_t.
Rejects when value > 0xFFFF. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5004 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryShort(), and TIFFReadDirEntryShortArray().
|
static |
Check whether uint64_t fits uint16_t.
Rejects when value > 0xFFFF. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5046 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryShort(), and TIFFReadDirEntryShortArray().
|
static |
Check whether int8_t fits uint16_t.
Rejects when value < 0. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4962 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryShort(), and TIFFReadDirEntryShortArray().
|
static |
Check whether int32_t fits uint16_t.
Rejects when (value < 0) || (value > 0xFFFF). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5025 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryShort(), and TIFFReadDirEntryShortArray().
|
static |
Check whether int64_t fits uint16_t.
Rejects when (value < 0) || (value > 0xFFFF). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5067 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryShort(), and TIFFReadDirEntryShortArray().
|
static |
Check whether int16_t fits uint16_t.
Rejects when value < 0. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 4983 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntryShort(), and TIFFReadDirEntryShortArray().
|
static |
Check whether uint64_t fits int64_t.
Rejects when value > INT64_MAX. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5448 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySlong8(), and TIFFReadDirEntrySlong8Array().
|
static |
Check whether uint32_t fits int32_t.
Rejects when value > 0x7FFFFFFFUL. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5298 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySlong(), and TIFFReadDirEntrySlongArray().
|
static |
Check whether uint64_t fits int32_t.
Rejects when value > 0x7FFFFFFF. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5320 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySlong(), and TIFFReadDirEntrySlongArray().
|
static |
Check whether int64_t fits int32_t.
Rejects when (value < 0 - ((int64_t)0x7FFFFFFF + 1)) || (value > 0x7FFFFFFF). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5343 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySlong(), and TIFFReadDirEntrySlongArray().
|
static |
Check whether uint32_t fits int16_t.
Rejects when value > 0x7FFF. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5109 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySshort(), and TIFFReadDirEntrySshortArray().
|
static |
Check whether uint64_t fits int16_t.
Rejects when value > 0x7FFF. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5151 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySshort(), and TIFFReadDirEntrySshortArray().
|
static |
Check whether uint16_t fits int16_t.
Rejects when value > 0x7FFF. Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5088 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySshort(), and TIFFReadDirEntrySshortArray().
|
static |
Check whether int32_t fits int16_t.
Rejects when (value < -0x8000) || (value > 0x7FFF). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5130 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySshort(), and TIFFReadDirEntrySshortArray().
|
static |
Check whether int64_t fits int16_t.
Rejects when (value < -0x8000) || (value > 0x7FFF). Performs no cast, allocation, diagnostic, state change, or ownership transfer.
| [in] | value | Source scalar whose representable target range is checked. |
Definition at line 5172 of file tif_dirread.c.
References TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrRange.
Referenced by TIFFReadDirEntrySshort(), and TIFFReadDirEntrySshortArray().
|
static |
Copy a raw external byte range into caller storage.
Requires adequate non-overlapping destination. Rejects a non-positive size before accessing the destination or performing I/O. Copies mapped bytes after extent checks, or seeks/reads client I/O. Does not swap/convert, allocate, transfer ownership, or issue a direct diagnostic. A short read can partially overwrite the output and move I/O position.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | offset | Byte offset of source data. |
| [in] | size | Requested byte count; non-positive values are rejected. |
| [out] | dest | Writable caller-owned buffer of size bytes for positive size. |
Definition at line 5474 of file tif_dirread.c.
References _TIFFmemcpy(), isMapped, ReadOK, SeekOK, tiff::tif_base, tiff::tif_size, TIFFReadDirEntryErrIo, TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrSizesan.
Referenced by _TIFFReadDirEntryCheckedRational(), TIFFFetchSubjectDistance(), TIFFReadDirEntryArrayWithLimit(), TIFFReadDirEntryCheckedDouble(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSlong8(), and TIFFReadDirEntryCheckedSrational().
|
static |
Grow an owned buffer while reading an external value.
Requires non-mapped I/O and a NULL or matching Ext allocation slot. Seeks to offset, then reallocates and reads progressively (1 MiB, factor ten growth on 64-bit hosts); 32-bit hosts request the full size. Updates *pdest after each successful realloc. On allocation/read failure retains the latest allocation and partial contents for the caller to release with _TIFFfreeExt(); old addresses can already be invalidated. Does not restore file position. Rejects a non-positive size before seeking or reallocating. Allocation failure is diagnosed; seek/read errors return codes without a direct helper diagnostic.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | offset | Start offset in file bytes. |
| [in] | size | Requested byte count; non-positive values are rejected. |
| [in,out] | pdest | Non-NULL owner slot; caller retains responsibility for the latest pointer on all exits. |
Definition at line 1577 of file tif_dirread.c.
References _TIFFreallocExt(), INITIAL_THRESHOLD, isMapped, MAX_THRESHOLD, SeekOK, THRESHOLD_MULTIPLIER, tiff::tif_name, TIFF_SSIZE_FORMAT, TIFFErrorExtR(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrIo, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrSizesan, and TIFFReadFile.
Referenced by TIFFReadDirEntryArrayWithLimit().
|
static |
Convert one directory value to double.
Requires count exactly one. Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8, TIFF_RATIONAL, TIFF_SRATIONAL, TIFF_FLOAT, TIFF_DOUBLE. TIFF_DOUBLE is copied and TIFF_FLOAT and the 8- to 32-bit integer types convert exactly; TIFF_LONG8/TIFF_SLONG8 magnitudes above 2^53 may lose precision. Rationals are divided in double precision; a zero denominator gives zero, and SRATIONAL uses a signed numerator over an unsigned denominator. No range errors are returned. TIFF_LONG8, TIFF_SLONG8, TIFF_RATIONAL, TIFF_SRATIONAL and TIFF_DOUBLE values are read from the file at the entry offset in classic TIFF (seeking unless memory-mapped) and from the inline entry bytes in BigTIFF; all other accepted types are inline. Performs no allocation and emits no diagnostics itself; errors are returned for the caller to report. *value is written only on success, except that an I/O failure can leave it partially written when it is the read destination.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned scalar slot; valid only on TIFFReadDirEntryErrOk. |
Definition at line 1397 of file tif_dirread.c.
References _TIFFReadDirEntryCheckedRational(), TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_type, TIFF_BYTE, TIFF_DOUBLE, TIFF_FLOAT, TIFF_LONG, TIFF_LONG8, TIFF_RATIONAL, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SRATIONAL, TIFF_SSHORT, TIFFReadDirEntryCheckedByte(), TIFFReadDirEntryCheckedDouble(), TIFFReadDirEntryCheckedFloat(), TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSbyte(), TIFFReadDirEntryCheckedShort(), TIFFReadDirEntryCheckedSlong(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryCheckedSrational(), TIFFReadDirEntryCheckedSshort(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrType.
Referenced by TIFFFetchNormalTag().
|
static |
Read a directory array as double elements.
Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8, TIFF_RATIONAL, TIFF_SRATIONAL, TIFF_FLOAT, TIFF_DOUBLE. Fetches the raw elements with TIFFReadDirEntryArray() (inline bytes, or file data that may be sought and read when not memory-mapped) and swaps them to host order. TIFF_DOUBLE is returned as fetched. Other types are converted into a new array with C casts; only TIFF_LONG8/TIFF_SLONG8 magnitudes above 2^53 can lose precision. Rationals are divided in double precision; a zero denominator gives zero, and SRATIONAL uses a signed numerator over an unsigned denominator. No range errors are returned. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL. An existing allocation in *value is not freed. *value is set to NULL when the raw fetch fails; type and allocation errors leave it unchanged. Temporary buffers are freed on every error path. The oversized-request check and allocation failures emit diagnostics; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
Definition at line 3796 of file tif_dirread.c.
References _TIFFfreeExt(), _TIFFmallocExt(), TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_BYTE, TIFF_DOUBLE, TIFF_FLOAT, TIFF_LONG, TIFF_LONG8, TIFF_RATIONAL, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SRATIONAL, TIFF_SSHORT, TIFF_SWAB, TIFFCvtIEEEDoubleToNative, TIFFCvtIEEEFloatToNative, TIFFReadDirEntryArray(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFSwabArrayOfLong(), TIFFSwabArrayOfLong8(), TIFFSwabLong(), TIFFSwabLong8(), and TIFFSwabShort().
Referenced by TIFFFetchNormalTag(), and TIFFReadDirectory().
|
static |
Convert one directory value to float.
Requires count exactly one. Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8, TIFF_RATIONAL, TIFF_SRATIONAL, TIFF_FLOAT, TIFF_DOUBLE. TIFF_FLOAT is copied. Integer sources are converted with a C cast and may lose precision. Rationals are divided in double precision and then cast; a zero denominator gives zero, and SRATIONAL uses a signed numerator over an unsigned denominator. A TIFF_DOUBLE outside +/-FLT_MAX returns TIFFReadDirEntryErrRange; NaN and in-range values are cast. TIFF_LONG8, TIFF_SLONG8, TIFF_RATIONAL, TIFF_SRATIONAL and TIFF_DOUBLE values are read from the file at the entry offset in classic TIFF (seeking unless memory-mapped) and from the inline entry bytes in BigTIFF; all other accepted types are inline. Performs no allocation and emits no diagnostics itself; errors are returned for the caller to report. *value is written only on success, except that an I/O failure can leave it partially written when it is the read destination.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned scalar slot; valid only on TIFFReadDirEntryErrOk. |
Definition at line 1264 of file tif_dirread.c.
References _TIFFReadDirEntryCheckedRational(), TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_type, TIFF_BYTE, TIFF_DOUBLE, TIFF_FLOAT, TIFF_LONG, TIFF_LONG8, TIFF_RATIONAL, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SRATIONAL, TIFF_SSHORT, TIFFReadDirEntryCheckedByte(), TIFFReadDirEntryCheckedDouble(), TIFFReadDirEntryCheckedFloat(), TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSbyte(), TIFFReadDirEntryCheckedShort(), TIFFReadDirEntryCheckedSlong(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryCheckedSrational(), TIFFReadDirEntryCheckedSshort(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrRange, and TIFFReadDirEntryErrType.
Referenced by TIFFFetchNormalTag().
|
static |
Read a directory array as float elements.
Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8, TIFF_RATIONAL, TIFF_SRATIONAL, TIFF_FLOAT, TIFF_DOUBLE. Fetches the raw elements with TIFFReadDirEntryArray() (inline bytes, or file data that may be sought and read when not memory-mapped) and swaps them to host order. TIFF_FLOAT is returned as fetched. Other types are converted into a new array with C casts, which may lose precision. Rationals are divided in float precision; a zero denominator gives zero, and SRATIONAL uses a signed numerator over an unsigned denominator. No range errors are returned. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL. An existing allocation in *value is not freed. *value is set to NULL when the raw fetch fails; type and allocation errors leave it unchanged. Temporary buffers are freed on every error path. The oversized-request check and allocation failures emit diagnostics; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
Definition at line 3525 of file tif_dirread.c.
References _TIFFCheckMalloc(), _TIFFfreeExt(), TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_BYTE, TIFF_DOUBLE, TIFF_FLOAT, TIFF_LONG, TIFF_LONG8, TIFF_RATIONAL, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SRATIONAL, TIFF_SSHORT, TIFF_SWAB, TIFFCvtIEEEDoubleToNative, TIFFCvtIEEEFloatToNative, TIFFReadDirEntryArray(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFSwabArrayOfLong(), TIFFSwabArrayOfLong8(), TIFFSwabLong(), TIFFSwabLong8(), and TIFFSwabShort().
Referenced by TIFFFetchNormalTag().
|
static |
Convert one directory value to uint64_t directory offset.
Requires count exactly one. Accepts TIFF_LONG, TIFF_IFD, TIFF_LONG8, TIFF_IFD8. TIFF_LONG/TIFF_IFD values are widened and TIFF_LONG8/TIFF_IFD8 are copied; no range checks apply. TIFF_LONG8 and TIFF_IFD8 values are read from the file at the entry offset in classic TIFF (seeking unless memory-mapped) and from the inline entry bytes in BigTIFF; all other accepted types are inline. Performs no allocation and emits no diagnostics itself; errors are returned for the caller to report. *value is written only on success, except that an I/O failure can leave it partially written when it is the read destination.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned scalar slot; valid only on TIFFReadDirEntryErrOk. |
Definition at line 1509 of file tif_dirread.c.
References TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_type, TIFF_IFD, TIFF_IFD8, TIFF_LONG, TIFF_LONG8, TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrType.
Referenced by TIFFFetchNormalTag().
|
static |
Read a directory array as uint64_t directory offset elements.
Accepts TIFF_LONG, TIFF_LONG8, TIFF_IFD, TIFF_IFD8. Fetches the raw elements with TIFFReadDirEntryArray() (inline bytes, or file data that may be sought and read when not memory-mapped) and swaps them to host order. TIFF_LONG8 and TIFF_IFD8 are returned as fetched; TIFF_LONG and TIFF_IFD are widened into a new array. No range checks apply. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL. An existing allocation in *value is not freed. *value is set to NULL when the raw fetch fails; type and allocation errors leave it unchanged. Temporary buffers are freed on every error path. The oversized-request check and allocation failures emit diagnostics; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
Definition at line 4055 of file tif_dirread.c.
References _TIFFCheckMalloc(), _TIFFfreeExt(), TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_IFD, TIFF_IFD8, TIFF_LONG, TIFF_LONG8, TIFF_SWAB, TIFFReadDirEntryArray(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFSwabArrayOfLong8(), and TIFFSwabLong().
Referenced by TIFFFetchNormalTag().
|
static |
Convert one directory value to uint32_t.
Requires count exactly one. Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_IFD, TIFF_SLONG, TIFF_LONG8, TIFF_IFD8, TIFF_SLONG8. TIFF_LONG/TIFF_IFD are copied and TIFF_BYTE/TIFF_SHORT widened; the other types are rejected with TIFFReadDirEntryErrRange unless the value is in 0..UINT32_MAX. TIFF_LONG8, TIFF_IFD8 and TIFF_SLONG8 values are read from the file at the entry offset in classic TIFF (seeking unless memory-mapped) and from the inline entry bytes in BigTIFF; all other accepted types are inline. Performs no allocation and emits no diagnostics itself; errors are returned for the caller to report. *value is written only on success, except that an I/O failure can leave it partially written when it is the read destination.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned scalar slot; valid only on TIFFReadDirEntryErrOk. |
Definition at line 848 of file tif_dirread.c.
References TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_type, TIFF_BYTE, TIFF_IFD, TIFF_IFD8, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFFReadDirEntryCheckedByte(), TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSbyte(), TIFFReadDirEntryCheckedShort(), TIFFReadDirEntryCheckedSlong(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryCheckedSshort(), TIFFReadDirEntryCheckRangeLongLong8(), TIFFReadDirEntryCheckRangeLongSbyte(), TIFFReadDirEntryCheckRangeLongSlong(), TIFFReadDirEntryCheckRangeLongSlong8(), TIFFReadDirEntryCheckRangeLongSshort(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrType.
Referenced by TIFFFetchNormalTag().
|
static |
Convert one directory value to uint64_t.
Requires count exactly one. Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_IFD, TIFF_SLONG, TIFF_LONG8, TIFF_IFD8, TIFF_SLONG8. TIFF_LONG8/TIFF_IFD8 are copied and the unsigned types widened; negative TIFF_SBYTE, TIFF_SSHORT, TIFF_SLONG and TIFF_SLONG8 values are rejected with TIFFReadDirEntryErrRange. TIFF_LONG8, TIFF_IFD8 and TIFF_SLONG8 values are read from the file at the entry offset in classic TIFF (seeking unless memory-mapped) and from the inline entry bytes in BigTIFF; all other accepted types are inline. Performs no allocation and emits no diagnostics itself; errors are returned for the caller to report. *value is written only on success, except that an I/O failure can leave it partially written when it is the read destination.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned scalar slot; valid only on TIFFReadDirEntryErrOk. |
Definition at line 1061 of file tif_dirread.c.
References TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_type, TIFF_BYTE, TIFF_IFD, TIFF_IFD8, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFFReadDirEntryCheckedByte(), TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSbyte(), TIFFReadDirEntryCheckedShort(), TIFFReadDirEntryCheckedSlong(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryCheckedSshort(), TIFFReadDirEntryCheckRangeLong8Sbyte(), TIFFReadDirEntryCheckRangeLong8Slong(), TIFFReadDirEntryCheckRangeLong8Slong8(), TIFFReadDirEntryCheckRangeLong8Sshort(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrType.
Referenced by TIFFFetchNormalTag().
|
static |
Read a directory array as uint64_t elements.
Calls TIFFReadDirEntryLong8ArrayWithLimit() with no element limit; see that function for the accepted types, conversions, range errors and error-path state of *value. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
Definition at line 3303 of file tif_dirread.c.
References TIFFReadDirEntryLong8ArrayWithLimit().
Referenced by TIFFFetchNormalTag().
|
static |
Read a directory array as uint64_t elements.
Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8, TIFF_IFD, TIFF_IFD8. Reads at most maxcount elements. Fetches the raw elements with TIFFReadDirEntryArrayWithLimit() (inline bytes, or file data that may be sought and read when not memory-mapped) and swaps them to host order. TIFF_LONG8 and TIFF_IFD8 are returned as fetched; TIFF_SLONG8 is range-checked in place. Other types are converted into a new array: the unsigned types are widened, and a negative signed element fails with TIFFReadDirEntryErrRange. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL. An existing allocation in *value is not freed. *value is set to NULL when the raw fetch fails; type, allocation and range errors leave it unchanged. Temporary buffers are freed on every error path. The oversized-request check and allocation failures emit diagnostics; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
| [in] | maxcount | Maximum elements to read/convert; preserves inline-versus-external placement from the original count. |
Definition at line 3106 of file tif_dirread.c.
References _TIFFCheckMalloc(), _TIFFfreeExt(), TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_BYTE, TIFF_IFD, TIFF_IFD8, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFF_SWAB, TIFFReadDirEntryArrayWithLimit(), TIFFReadDirEntryCheckRangeLong8Sbyte(), TIFFReadDirEntryCheckRangeLong8Slong(), TIFFReadDirEntryCheckRangeLong8Slong8(), TIFFReadDirEntryCheckRangeLong8Sshort(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFSwabArrayOfLong8(), TIFFSwabLong(), TIFFSwabLong8(), and TIFFSwabShort().
Referenced by TIFFFetchStripThing(), and TIFFReadDirEntryLong8Array().
|
static |
Read a directory array as uint32_t elements.
Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8, TIFF_IFD, TIFF_IFD8. Fetches the raw elements with TIFFReadDirEntryArray() (inline bytes, or file data that may be sought and read when not memory-mapped) and swaps them to host order. TIFF_LONG and TIFF_IFD are returned as fetched; TIFF_SLONG is range-checked in place. Other types are converted into a new array: TIFF_BYTE and TIFF_SHORT are widened, and any other element outside 0..UINT32_MAX fails with TIFFReadDirEntryErrRange. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL. An existing allocation in *value is not freed. *value is set to NULL when the raw fetch fails; type, allocation and range errors leave it unchanged. Temporary buffers are freed on every error path. The oversized-request check and allocation failures emit diagnostics; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
Definition at line 2701 of file tif_dirread.c.
References _TIFFCheckMalloc(), _TIFFfreeExt(), TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_BYTE, TIFF_IFD, TIFF_IFD8, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFF_SWAB, TIFFReadDirEntryArray(), TIFFReadDirEntryCheckRangeLongLong8(), TIFFReadDirEntryCheckRangeLongSbyte(), TIFFReadDirEntryCheckRangeLongSlong(), TIFFReadDirEntryCheckRangeLongSlong8(), TIFFReadDirEntryCheckRangeLongSshort(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFSwabArrayOfLong(), TIFFSwabLong(), TIFFSwabLong8(), and TIFFSwabShort().
Referenced by TIFFFetchNormalTag().
|
static |
Report a directory-entry conversion error at the requested severity.
Dispatches a synchronous per-handle/global diagnostic using borrowed context strings. recover changes error to warning and appends the ignored-tag message; it does not itself ignore, undo, or free a value. Passing Ok or an unknown code is a programmer error asserted in debug builds. No ownership transfers.
| [in] | tif | Non-NULL handle; used only to dispatch diagnostics. |
| [in] | err | Known non-Ok TIFFReadDirEntryErr value. |
| [in] | module | Borrowed diagnostic context string, or NULL as permitted by diagnostics. |
| [in] | tagname | Non-NULL readable terminated tag name. |
| [in] | recover | Nonzero for a recoverable warning, zero for an error. |
Definition at line 5519 of file tif_dirread.c.
References TIFFErrorExtR(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrCount, TIFFReadDirEntryErrIo, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrPsdif, TIFFReadDirEntryErrRange, TIFFReadDirEntryErrSizesan, TIFFReadDirEntryErrType, and TIFFWarningExtR().
Referenced by TIFFFetchNormalTag(), TIFFFetchStripThing(), TIFFFetchSubjectDistance(), and TIFFReadDirectory().
|
static |
Reduce equal per-sample short values to one scalar.
Requires positive SamplesPerPixel. Converts an allocated short array, compares the expected present values, and frees it. Zero count fails; short nonzero count warns and assumes missing values equal the first; extra count warns and is ignored after conversion. Writes the first value before discovering later differences, so failure need not preserve output. May read external data and change client I/O position; allocations/limits or callbacks can emit diagnostics, but conversion failures normally return an error code for the caller to report. No input ownership transfers. Use outputs only on the documented success path; failure does not generally preserve them.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL scalar slot; valid only after successful nonempty conversion/equality check. |
Definition at line 4146 of file tif_dirread.c.
References _TIFFfreeExt(), _TIFFField::field_name, TIFFDirectory::td_samplesperpixel, TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_tag, tiff::tif_dir, TIFFFieldWithTag(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrPsdif, TIFFReadDirEntryShortArray(), and TIFFWarningExtR().
Referenced by TIFFReadDirectory().
|
static |
Convert one directory value to int8_t.
Requires count exactly one. Accepts TIFF_BYTE, TIFF_UNDEFINED, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. TIFF_SBYTE is copied; every other type is rejected with TIFFReadDirEntryErrRange unless the value is in INT8_MIN..INT8_MAX. TIFF_LONG8 and TIFF_SLONG8 values are read from the file at the entry offset in classic TIFF (seeking unless memory-mapped) and from the inline entry bytes in BigTIFF; all other accepted types are inline. Performs no allocation and emits no diagnostics itself; errors are returned for the caller to report. *value is written only on success, except that an I/O failure can leave it partially written when it is the read destination.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned scalar slot; valid only on TIFFReadDirEntryErrOk. |
Definition at line 510 of file tif_dirread.c.
References TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_type, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFF_UNDEFINED, TIFFReadDirEntryCheckedByte(), TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSbyte(), TIFFReadDirEntryCheckedShort(), TIFFReadDirEntryCheckedSlong(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryCheckedSshort(), TIFFReadDirEntryCheckRangeSbyteByte(), TIFFReadDirEntryCheckRangeSbyteLong(), TIFFReadDirEntryCheckRangeSbyteLong8(), TIFFReadDirEntryCheckRangeSbyteShort(), TIFFReadDirEntryCheckRangeSbyteSlong(), TIFFReadDirEntryCheckRangeSbyteSlong8(), TIFFReadDirEntryCheckRangeSbyteSshort(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrType.
Referenced by TIFFFetchNormalTag().
|
static |
Read a directory array as int8_t elements.
Accepts TIFF_UNDEFINED, TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. Fetches the raw elements with TIFFReadDirEntryArray() (inline bytes, or file data that may be sought and read when not memory-mapped) and swaps them to host order. TIFF_SBYTE is returned as fetched; TIFF_UNDEFINED and TIFF_BYTE are range-checked in place. Wider types are converted into a new array. Any element outside INT8_MIN..INT8_MAX fails with TIFFReadDirEntryErrRange. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL. An existing allocation in *value is not freed. *value is set to NULL when the raw fetch fails; type, allocation and range errors leave it unchanged. Temporary buffers are freed on every error path. The oversized-request check and allocation failures emit diagnostics; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
Definition at line 2083 of file tif_dirread.c.
References _TIFFfreeExt(), _TIFFmallocExt(), TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFF_SWAB, TIFF_UNDEFINED, TIFFReadDirEntryArray(), TIFFReadDirEntryCheckRangeSbyteByte(), TIFFReadDirEntryCheckRangeSbyteLong(), TIFFReadDirEntryCheckRangeSbyteLong8(), TIFFReadDirEntryCheckRangeSbyteShort(), TIFFReadDirEntryCheckRangeSbyteSlong(), TIFFReadDirEntryCheckRangeSbyteSlong8(), TIFFReadDirEntryCheckRangeSbyteSshort(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFSwabLong(), TIFFSwabLong8(), and TIFFSwabShort().
Referenced by TIFFFetchNormalTag().
|
static |
Convert one directory value to uint16_t.
Requires count exactly one. Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. TIFF_SHORT is copied and TIFF_BYTE widened; the other types are rejected with TIFFReadDirEntryErrRange unless the value is in 0..UINT16_MAX. TIFF_LONG8 and TIFF_SLONG8 values are read from the file at the entry offset in classic TIFF (seeking unless memory-mapped) and from the inline entry bytes in BigTIFF; all other accepted types are inline. Performs no allocation and emits no diagnostics itself; errors are returned for the caller to report. *value is written only on success, except that an I/O failure can leave it partially written when it is the read destination.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned scalar slot; valid only on TIFFReadDirEntryErrOk. |
Definition at line 628 of file tif_dirread.c.
References TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_type, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFFReadDirEntryCheckedByte(), TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSbyte(), TIFFReadDirEntryCheckedShort(), TIFFReadDirEntryCheckedSlong(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryCheckedSshort(), TIFFReadDirEntryCheckRangeShortLong(), TIFFReadDirEntryCheckRangeShortLong8(), TIFFReadDirEntryCheckRangeShortSbyte(), TIFFReadDirEntryCheckRangeShortSlong(), TIFFReadDirEntryCheckRangeShortSlong8(), TIFFReadDirEntryCheckRangeShortSshort(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrType.
Referenced by TIFFFetchNormalTag(), and TIFFReadDirectory().
|
static |
Read a directory array as uint16_t elements.
Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. Fetches the raw elements with TIFFReadDirEntryArray() (inline bytes, or file data that may be sought and read when not memory-mapped) and swaps them to host order. TIFF_SHORT is returned as fetched; TIFF_SSHORT is range-checked in place. Other types are converted into a new array: TIFF_BYTE is widened, and any other element outside 0..UINT16_MAX fails with TIFFReadDirEntryErrRange. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL. An existing allocation in *value is not freed. *value is set to NULL when the raw fetch fails; type, allocation and range errors leave it unchanged. Temporary buffers are freed on every error path. The oversized-request check and allocation failures emit diagnostics; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
Definition at line 2294 of file tif_dirread.c.
References _TIFFCheckMalloc(), _TIFFfreeExt(), TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFF_SWAB, TIFFReadDirEntryArray(), TIFFReadDirEntryCheckRangeShortLong(), TIFFReadDirEntryCheckRangeShortLong8(), TIFFReadDirEntryCheckRangeShortSbyte(), TIFFReadDirEntryCheckRangeShortSlong(), TIFFReadDirEntryCheckRangeShortSlong8(), TIFFReadDirEntryCheckRangeShortSshort(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFSwabArrayOfShort(), TIFFSwabLong(), TIFFSwabLong8(), and TIFFSwabShort().
Referenced by TIFFFetchNormalTag(), TIFFReadDirectory(), and TIFFReadDirEntryPersampleShort().
|
static |
Convert one directory value to int32_t.
Requires count exactly one. Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. TIFF_SLONG is copied and the 8- and 16-bit types widened; TIFF_LONG, TIFF_LONG8 and TIFF_SLONG8 are rejected with TIFFReadDirEntryErrRange unless the value is in INT32_MIN..INT32_MAX. TIFF_LONG8 and TIFF_SLONG8 values are read from the file at the entry offset in classic TIFF (seeking unless memory-mapped) and from the inline entry bytes in BigTIFF; all other accepted types are inline. Performs no allocation and emits no diagnostics itself; errors are returned for the caller to report. *value is written only on success, except that an I/O failure can leave it partially written when it is the read destination.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned scalar slot; valid only on TIFFReadDirEntryErrOk. |
Definition at line 958 of file tif_dirread.c.
References TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_type, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFFReadDirEntryCheckedByte(), TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSbyte(), TIFFReadDirEntryCheckedShort(), TIFFReadDirEntryCheckedSlong(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryCheckedSshort(), TIFFReadDirEntryCheckRangeSlongLong(), TIFFReadDirEntryCheckRangeSlongLong8(), TIFFReadDirEntryCheckRangeSlongSlong8(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrType.
Referenced by TIFFFetchNormalTag().
|
static |
Convert one directory value to int64_t.
Requires count exactly one. Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. TIFF_SLONG8 is copied and the 8- to 32-bit types widened; TIFF_LONG8 values above INT64_MAX are rejected with TIFFReadDirEntryErrRange. TIFF_LONG8 and TIFF_SLONG8 values are read from the file at the entry offset in classic TIFF (seeking unless memory-mapped) and from the inline entry bytes in BigTIFF; all other accepted types are inline. Performs no allocation and emits no diagnostics itself; errors are returned for the caller to report. *value is written only on success, except that an I/O failure can leave it partially written when it is the read destination.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned scalar slot; valid only on TIFFReadDirEntryErrOk. |
Definition at line 1166 of file tif_dirread.c.
References TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_type, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFFReadDirEntryCheckedByte(), TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSbyte(), TIFFReadDirEntryCheckedShort(), TIFFReadDirEntryCheckedSlong(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryCheckedSshort(), TIFFReadDirEntryCheckRangeSlong8Long8(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrType.
Referenced by TIFFFetchNormalTag().
|
static |
Read a directory array as int64_t elements.
Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. Fetches the raw elements with TIFFReadDirEntryArray() (inline bytes, or file data that may be sought and read when not memory-mapped) and swaps them to host order. TIFF_SLONG8 is returned as fetched; TIFF_LONG8 is range-checked in place and an element above INT64_MAX fails with TIFFReadDirEntryErrRange. The 8- to 32-bit types are widened into a new array without checks. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL. An existing allocation in *value is not freed. *value is set to NULL when the raw fetch fails; type, allocation and range errors leave it unchanged. Temporary buffers are freed on every error path. The oversized-request check and allocation failures emit diagnostics; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
Definition at line 3337 of file tif_dirread.c.
References _TIFFCheckMalloc(), _TIFFfreeExt(), TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFF_SWAB, TIFFReadDirEntryArray(), TIFFReadDirEntryCheckRangeSlong8Long8(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFSwabArrayOfLong8(), TIFFSwabLong(), TIFFSwabLong8(), and TIFFSwabShort().
Referenced by TIFFFetchNormalTag().
|
static |
Read a directory array as int32_t elements.
Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. Fetches the raw elements with TIFFReadDirEntryArray() (inline bytes, or file data that may be sought and read when not memory-mapped) and swaps them to host order. TIFF_SLONG is returned as fetched; TIFF_LONG is range-checked in place. Other types are converted into a new array: the 8- and 16-bit types are widened, and TIFF_LONG8/TIFF_SLONG8 elements outside INT32_MIN..INT32_MAX fail with TIFFReadDirEntryErrRange. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL. An existing allocation in *value is not freed. *value is set to NULL when the raw fetch fails; type, allocation and range errors leave it unchanged. Temporary buffers are freed on every error path. The oversized-request check and allocation failures emit diagnostics; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
Definition at line 2908 of file tif_dirread.c.
References _TIFFCheckMalloc(), _TIFFfreeExt(), TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFF_SWAB, TIFFReadDirEntryArray(), TIFFReadDirEntryCheckRangeSlongLong(), TIFFReadDirEntryCheckRangeSlongLong8(), TIFFReadDirEntryCheckRangeSlongSlong8(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFSwabArrayOfLong(), TIFFSwabLong(), TIFFSwabLong8(), and TIFFSwabShort().
Referenced by TIFFFetchNormalTag().
|
static |
Convert one directory value to int16_t.
Requires count exactly one. Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. TIFF_SSHORT is copied and TIFF_BYTE/TIFF_SBYTE widened; the other types are rejected with TIFFReadDirEntryErrRange unless the value is in INT16_MIN..INT16_MAX. TIFF_LONG8 and TIFF_SLONG8 values are read from the file at the entry offset in classic TIFF (seeking unless memory-mapped) and from the inline entry bytes in BigTIFF; all other accepted types are inline. Performs no allocation and emits no diagnostics itself; errors are returned for the caller to report. *value is written only on success, except that an I/O failure can leave it partially written when it is the read destination.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL caller-owned scalar slot; valid only on TIFFReadDirEntryErrOk. |
Definition at line 739 of file tif_dirread.c.
References TIFFDirEntry::tdir_count, TIFFDirEntry::tdir_type, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFFReadDirEntryCheckedByte(), TIFFReadDirEntryCheckedLong(), TIFFReadDirEntryCheckedLong8(), TIFFReadDirEntryCheckedSbyte(), TIFFReadDirEntryCheckedShort(), TIFFReadDirEntryCheckedSlong(), TIFFReadDirEntryCheckedSlong8(), TIFFReadDirEntryCheckedSshort(), TIFFReadDirEntryCheckRangeSshortLong(), TIFFReadDirEntryCheckRangeSshortLong8(), TIFFReadDirEntryCheckRangeSshortShort(), TIFFReadDirEntryCheckRangeSshortSlong(), TIFFReadDirEntryCheckRangeSshortSlong8(), TIFFReadDirEntryErrCount, TIFFReadDirEntryErrOk, and TIFFReadDirEntryErrType.
Referenced by TIFFFetchNormalTag().
|
static |
Read a directory array as int16_t elements.
Accepts TIFF_BYTE, TIFF_SBYTE, TIFF_SHORT, TIFF_SSHORT, TIFF_LONG, TIFF_SLONG, TIFF_LONG8, TIFF_SLONG8. Fetches the raw elements with TIFFReadDirEntryArray() (inline bytes, or file data that may be sought and read when not memory-mapped) and swaps them to host order. TIFF_SSHORT is returned as fetched; TIFF_SHORT is range-checked in place. Other types are converted into a new array: TIFF_BYTE and TIFF_SBYTE are widened, and any other element outside INT16_MIN..INT16_MAX fails with TIFFReadDirEntryErrRange. On success *value receives a new allocation owned by the caller and released with _TIFFfreeExt(); a zero count succeeds with *value NULL. An existing allocation in *value is not freed. *value is set to NULL when the raw fetch fails; type, allocation and range errors leave it unchanged. Temporary buffers are freed on every error path. The oversized-request check and allocation failures emit diagnostics; other errors are only returned.
| [in,out] | tif | Non-NULL live handle with matching schema/state; serialise access externally. |
| [in] | direntry | Non-NULL parsed entry with host-order tag/type/count and raw offset/inline bytes; borrowed only for this call. |
| [out] | value | Non-NULL empty owner slot for the new element array; valid only on success. |
Definition at line 2500 of file tif_dirread.c.
References _TIFFCheckMalloc(), _TIFFfreeExt(), TIFFDirEntry::tdir_type, tiff::tif_flags, TIFF_BYTE, TIFF_LONG, TIFF_LONG8, TIFF_SBYTE, TIFF_SHORT, TIFF_SLONG, TIFF_SLONG8, TIFF_SSHORT, TIFF_SWAB, TIFFReadDirEntryArray(), TIFFReadDirEntryCheckRangeSshortLong(), TIFFReadDirEntryCheckRangeSshortLong8(), TIFFReadDirEntryCheckRangeSshortShort(), TIFFReadDirEntryCheckRangeSshortSlong(), TIFFReadDirEntryCheckRangeSshortSlong8(), TIFFReadDirEntryErrAlloc, TIFFReadDirEntryErrOk, TIFFReadDirEntryErrType, TIFFSwabArrayOfShort(), TIFFSwabLong(), TIFFSwabLong8(), and TIFFSwabShort().
Referenced by TIFFFetchNormalTag().
|
static |
Copy eight unaligned bytes into a native uint64_t value.
Does not swap file byte order, allocate, validate the buffer extent, or transfer ownership; no handle state or diagnostics.
| [in] | value | Borrowed readable buffer of at least eight bytes; no alignment required. |
Definition at line 353 of file tif_dirread.c.
References _UInt64Aligned_t::c, and _UInt64Aligned_t::l.
Referenced by TIFFFetchDirectory().