forge
Explore
Log in

Don't you dare go Hollow

B13: ec-image TIFF info() reports IFD0 orientation instead of always 1

Browse files at this commit

8f9f453b224d63deb2968d1f905a9da27cea0facAhmet Kaan GümüşParent: 22f0f3f
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.rsmodified+1 -2
@@ -340,8 +340,7 @@ pub fn info(data: &[u8]) -> Result<Info> {
340340 format: ImageFormat::Tiff,
341341 width: layout.width,
342342 height: layout.height,
343- // Not read: TIFF orientation lives in the first directory, which `layout` does not keep.
344- orientation: 1,
343+ orientation: layout.orientation.unwrap_or(1),
345344 })
346345 }
347346
crates/ec-image/tests/it/gaps.rsmodified+10 -0
@@ -414,3 +414,13 @@ fn probing_arbitrary_mutations_never_panics() {
414414 }
415415 }
416416 }
417+
418+#[test]
419+fn tiff_info_reports_the_ifd0_orientation() {
420+ for o in 1..=8u16 {
421+ assert_eq!(
422+ ec_image::info(&tiff(o, false)).unwrap().orientation,
423+ o as u8
424+ );
425+ }
426+}