From a919b8febf7fc461da000b2996c39c3705c74f76 Mon Sep 17 00:00:00 2001 From: Bastian Kersting Date: Fri, 29 Aug 2025 12:06:03 +0000 Subject: [PATCH] Fix type mismatch for reading Lists of Bytes At the moment when writing Byte strings into tiff metadata sections (like for XMP metadata) and try to read it with this crate, you will find your characters as a Value::UnsignedBig, holding the char value with padding. This seems wrong and we should instead return actual Value::Bytes. --- src/decoder/ifd.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/decoder/ifd.rs b/src/decoder/ifd.rs index 0b68d56..530c4da 100644 --- a/src/decoder/ifd.rs +++ b/src/decoder/ifd.rs @@ -577,10 +577,10 @@ impl Entry { Type::BYTE => self.decode_offset(self.count, bo, bigtiff, limits, reader, |reader| { let mut buf = [0; 1]; reader.inner().read_exact(&mut buf)?; - Ok(UnsignedBig(u64::from(buf[0]))) + Ok(Byte(buf[0])) }), Type::SBYTE => self.decode_offset(self.count, bo, bigtiff, limits, reader, |reader| { - Ok(SignedBig(i64::from(reader.read_i8()?))) + Ok(SignedByte(reader.read_i8()?)) }), Type::SHORT => self.decode_offset(self.count, bo, bigtiff, limits, reader, |reader| { Ok(Short(reader.read_u16()?))