From 902a8f5cbd4f5c4c08ea34e007d60e28f47c55de Mon Sep 17 00:00:00 2001 From: Kunal Pai Date: Thu, 29 Oct 2026 12:31:18 -0700 Subject: [PATCH] fix(tiff): read u32 values only from SHORT and LONG entries --- rust/src/tiff/directory.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/src/tiff/directory.rs b/rust/src/tiff/directory.rs index 4419830..25c54ca 100644 --- a/rust/src/tiff/directory.rs +++ b/rust/src/tiff/directory.rs @@ -339,7 +339,7 @@ impl TiffDirectory { let entry = self.find_entry(tag).ok_or(TiffError::TagNotFound { tag })?; let elem_size = match entry.type_ { TiffType::Short => 2, - TiffType::Long | TiffType::Ifd => 4, + TiffType::Long => 4, _ => { return Err(TiffError::TypeMismatch { tag, @@ -365,7 +365,7 @@ impl TiffDirectory { Endian::Big => u16::from_be_bytes([b[0], b[1]]) as u32, }) .collect()), - TiffType::Long | TiffType::Ifd => Ok(val_bytes[..required_bytes] + TiffType::Long => Ok(val_bytes[..required_bytes] .chunks_exact(4) .map(|b| match self.endian { Endian::Little => u32::from_le_bytes([b[0], b[1], b[2], b[3]]),