Bug 1464039 - Only reject qcms transform with invalid grid size if the transform function uses the grid size. r=Bas a=jcristau

This commit is contained in:
Nicolas Silva 2018-06-19 15:32:29 +02:00 • committed by Roy Tam
commit 1974d5079a
2 changed files with 8 additions and 2 deletions

View file

@ -972,7 +972,9 @@ static float* qcms_modular_transform_data(struct qcms_modular_transform *transfo
assert(0 && "Unsupported transform module"); assert(0 && "Unsupported transform module");
return NULL; return NULL;
} }
if (transform->grid_size <= 0) { if (transform->grid_size <= 0 &&
(transform_fn == qcms_transform_module_clut ||
transform_fn == qcms_transform_module_clut_only)) {
assert(0 && "Invalid transform"); assert(0 && "Invalid transform");
return NULL; return NULL;
} }

View file

@ -156,6 +156,7 @@ static Mutex* gGfxPlatformPrefsLock = nullptr;
static qcms_profile *gCMSOutputProfile = nullptr; static qcms_profile *gCMSOutputProfile = nullptr;
static qcms_profile *gCMSsRGBProfile = nullptr; static qcms_profile *gCMSsRGBProfile = nullptr;
static bool gCMSRGBTransformFailed = false;
static qcms_transform *gCMSRGBTransform = nullptr; static qcms_transform *gCMSRGBTransform = nullptr;
static qcms_transform *gCMSInverseRGBTransform = nullptr; static qcms_transform *gCMSInverseRGBTransform = nullptr;
static qcms_transform *gCMSRGBATransform = nullptr; static qcms_transform *gCMSRGBATransform = nullptr;
@ -1856,7 +1857,7 @@ gfxPlatform::GetCMSsRGBProfile()
qcms_transform * qcms_transform *
gfxPlatform::GetCMSRGBTransform() gfxPlatform::GetCMSRGBTransform()
{ {
if (!gCMSRGBTransform) { if (!gCMSRGBTransform && !gCMSRGBTransformFailed) {
qcms_profile *inProfile, *outProfile; qcms_profile *inProfile, *outProfile;
outProfile = GetCMSOutputProfile(); outProfile = GetCMSOutputProfile();
inProfile = GetCMSsRGBProfile(); inProfile = GetCMSsRGBProfile();
@ -1867,6 +1868,9 @@ gfxPlatform::GetCMSRGBTransform()
gCMSRGBTransform = qcms_transform_create(inProfile, QCMS_DATA_RGB_8, gCMSRGBTransform = qcms_transform_create(inProfile, QCMS_DATA_RGB_8,
outProfile, QCMS_DATA_RGB_8, outProfile, QCMS_DATA_RGB_8,
QCMS_INTENT_PERCEPTUAL); QCMS_INTENT_PERCEPTUAL);
if (!gCMSRGBTransform) {
gCMSRGBTransformFailed = true;
}
} }
return gCMSRGBTransform; return gCMSRGBTransform;