From 8f9f453b224d63deb2968d1f905a9da27cea0fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Dec 2026 09:35:24 +0300 Subject: [PATCH] B13: ec-image TIFF info() reports IFD0 orientation instead of always 1 Evidence: layout() reads tag 274 but info() hardcoded 1, so probe and decode disagreed. Output changes only for TIFF files with orientation 2..8 in info().orientation. Regression: tests/it/gaps.rs tiff_info_reports_the_ifd0_orientation. --- crates/ec-image/src/tiff.rs | 3 +-- crates/ec-image/tests/it/gaps.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/ec-image/src/tiff.rs b/crates/ec-image/src/tiff.rs index 986cc793..23ace55a 100644 --- a/crates/ec-image/src/tiff.rs +++ b/crates/ec-image/src/tiff.rs @@ -340,8 +340,7 @@ pub fn info(data: &[u8]) -> Result { format: ImageFormat::Tiff, width: layout.width, height: layout.height, - // Not read: TIFF orientation lives in the first directory, which `layout` does not keep. - orientation: 1, + orientation: layout.orientation.unwrap_or(1), }) } diff --git a/crates/ec-image/tests/it/gaps.rs b/crates/ec-image/tests/it/gaps.rs index d4b3aa0a..8c143847 100644 --- a/crates/ec-image/tests/it/gaps.rs +++ b/crates/ec-image/tests/it/gaps.rs @@ -414,3 +414,13 @@ fn probing_arbitrary_mutations_never_panics() { } } } + +#[test] +fn tiff_info_reports_the_ifd0_orientation() { + for o in 1..=8u16 { + assert_eq!( + ec_image::info(&tiff(o, false)).unwrap().orientation, + o as u8 + ); + } +}