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 <storybored379@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
storybored379 2026-10-04 07:13:14 -07:00 committed by GitHub
parent 9905db34ff
commit 7cb26e4f7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -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;