From 7cb26e4f7f31e443891ffa573c33635bbd95edea Mon Sep 17 00:00:00 2001 From: storybored379 Date: Sun, 4 Oct 2026 07:13:14 -0700 Subject: [PATCH] cms tests: system_profiles skips malformed named-colour profiles (#24) On Debian/Ubuntu with colord installed, system_profiles panics on /usr/share/color/icc/colord/x11-colors.icc ("unsupported ICC feature: curve type \0\1\0\0"). That profile is a named-colour (nmcl) profile whose B2A0 lutBToAType is spec-invalid: inputs=3, but the M-curve offset (32) leaves room for one curve before the matrix offset (48), and the 48-byte matrix overlaps the B curves at 64. The parser reads the second M curve at offset 48 and correctly rejects it. Named-colour profiles are never used for conversions (the test already skips them after parsing), so skip them when they fail to parse instead of failing the suite on a host file. Co-authored-by: storybored379 Co-authored-by: Claude Opus 5.5 --- crates/cms/tests/cms.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/cms/tests/cms.rs b/crates/cms/tests/cms.rs index 2a1ab9d603..c2ba6d3a75 100644 --- a/crates/cms/tests/cms.rs +++ b/crates/cms/tests/cms.rs @@ -402,7 +402,13 @@ fn system_profiles() { continue; } let Ok(bytes) = std::fs::read(&path) else { continue }; - let p = Profile::parse(&bytes).unwrap_or_else(|e| panic!("{}: {e}", path.display())); + let p = match Profile::parse(&bytes) { + Ok(p) => p, + // Named-colour profiles are never used for conversions; colord's + // x11-colors.icc carries a stub B2A0 with overlapping elements. + Err(_) if bytes.get(12..16) == Some(b"nmcl") => continue, + Err(e) => panic!("{}: {e}", path.display()), + }; seen += 1; if !matches!(p.class, photocraft_cms::ProfileClass::Input | photocraft_cms::ProfileClass::Display | photocraft_cms::ProfileClass::Output | photocraft_cms::ProfileClass::ColorSpace) { continue;