color_apply_icc_profile: avoid potential heap buffer overflow