[rust bmp] Fix issue on rust icc parsing detected by fuzzer

A fuzzer found that a profile with only TRC curves (no matrix) or only a
toXYZD50 matrix (no TRC) would pass the old check but cause
skcms_Transform to fail at runtime.

The previous validation in ToSkcmsIccProfile accepted an ICC profile as
long as it had any of: a toXYZD50 matrix, TRC curves, an A2B table, or a
B2A table. However, skcms_Transform requires a source profile to pass
usable_as_src(), which mandates either an A2B table or both TRC curves
and a toXYZD50 matrix together.

Fix: Tighten the validation to mirror skcms_Parse's usable_as_src()
logic: reject a profile that has neither an A2B table nor the (TRC +
toXYZD50) pair.

Tests: Added two regression tests covering the new rejection cases:

TRC curves present but toXYZD50 matrix absent toXYZD50 matrix present
but TRC curves absent Also updated the existing RustIcc_cicp_conversion
test to include TRC curves alongside the toXYZD50 matrix, which it was
previously missing (causing it to inadvertently test a profile that
would have failed usable_as_src()).

Bug: 498651220
Bug: 452666425
Change-Id: Ife654e9efb4252ec8f4331095331670fc3ed9811
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1200437
Commit-Queue: Kaylee Lubick <kjlubick@google.com>
Reviewed-by: Ɓukasz Anforowicz <lukasza@google.com>
Reviewed-by: Kaylee Lubick <kjlubick@google.com>
2 files changed