From bc3351eaccbc7af7cb0f4830ce0d675d18a8fc03 Mon Sep 17 00:00:00 2001 From: KnottyDyes <47539659+KnottyDyes@users.noreply.github.com> Date: Wed, 21 Oct 2026 01:13:38 -0600 Subject: [PATCH] ICC: all built-in profiles are checked for aligned sizes and tags The #1584 regression covered the four built-in RGB spaces. It now also checks gray and both CMYK profiles: header size equal to the length, a length that is a multiple of 4, tag offsets on 4-byte boundaries, tag data within the profile, and that the profile still parses. Co-Authored-By: Claude Opus 5.5 --- crates/color/src/cms/tests_icc.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/color/src/cms/tests_icc.rs b/crates/color/src/cms/tests_icc.rs index b3796d444..ae3697fe3 100644 --- a/crates/color/src/cms/tests_icc.rs +++ b/crates/color/src/cms/tests_icc.rs @@ -113,11 +113,11 @@ fn black_point_compensation_maps_the_darkest_ink_to_rgb_black() { assert_eq!(abs(true), abs(false)); } -/// #1584: the profiles written here (built-in RGB spaces) have every tag on a 4-byte boundary and -/// a size that is a multiple of 4 (ICC.1 §7.1.2), and still read back as the same space. +/// #1584: every built-in profile (RGB, CMYK and gray) has each tag on a 4-byte boundary and a size +/// that is a multiple of 4 (ICC.1 §7.1.2), and still reads back as the same space. #[test] -fn written_profiles_align_their_tags() { - for name in [super::SRGB, super::DISPLAY_P3, super::WIDE_GAMUT_RGB, super::PROPHOTO_RGB] { +fn builtin_profiles_align_their_sizes_and_tags() { + for name in BUILTIN_RGB.into_iter().chain(BUILTIN_CMYK).chain([GRAY]) { let icc = super::icc_bytes(name).unwrap(); let be = |at: usize| u32::from_be_bytes([icc[at], icc[at + 1], icc[at + 2], icc[at + 3]]) as usize; assert_eq!(be(0), icc.len(), "{name}: header size");