summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPale Moon <git-repo@palemoon.org>2018-07-01 13:33:39 +0200
committerPale Moon <git-repo@palemoon.org>2018-07-01 13:46:59 +0200
commitf929ffa0e3f379de95a5e074e4058ce3fd6aabfb (patch)
treeda4a67c4ab95130afa129d7f06b875eac02a4d38
parentd8e715cff61b5a401f4ac3c26c79b3a000047432 (diff)
downloadpalemoon-gre-f929ffa0e3f379de95a5e074e4058ce3fd6aabfb.tar.gz
Reject some invalid qcms transforms.
Note: Only reject qcms transform with invalid grid size if the transform function uses the grid size. Some transform functions don't use the table and grid size, and therefore are expected to work without valid values in these members, so we should not reject these.
-rw-r--r--gfx/qcms/chain.c6
-rw-r--r--gfx/thebes/gfxPlatform.cpp6
2 files changed, 11 insertions, 1 deletions
diff --git a/gfx/qcms/chain.c b/gfx/qcms/chain.c
index edc917153..125b0de3d 100644
--- a/gfx/qcms/chain.c
+++ b/gfx/qcms/chain.c
@@ -968,6 +968,12 @@ static float* qcms_modular_transform_data(struct qcms_modular_transform *transfo
assert(0 && "Unsupported transform module");
return NULL;
}
+ if (transform->grid_size <= 0 &&
+ (transform_fn == qcms_transform_module_clut ||
+ transform_fn == qcms_transform_module_clut_only)) {
+ assert(0 && "Invalid transform");
+ return NULL;
+ }
transform->transform_module_fn(transform,src,dest,len);
dest = src;
src = new_src;
diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp
index ed1b2ffda..3762f5fb9 100644
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -125,6 +125,7 @@ static Mutex* gGfxPlatformPrefsLock = nullptr;
static qcms_profile *gCMSOutputProfile = nullptr;
static qcms_profile *gCMSsRGBProfile = nullptr;
+static bool gCMSRGBTransformFailed = false;
static qcms_transform *gCMSRGBTransform = nullptr;
static qcms_transform *gCMSInverseRGBTransform = nullptr;
static qcms_transform *gCMSRGBATransform = nullptr;
@@ -1902,7 +1903,7 @@ gfxPlatform::GetCMSsRGBProfile()
qcms_transform *
gfxPlatform::GetCMSRGBTransform()
{
- if (!gCMSRGBTransform) {
+ if (!gCMSRGBTransform && !gCMSRGBTransformFailed) {
qcms_profile *inProfile, *outProfile;
outProfile = GetCMSOutputProfile();
inProfile = GetCMSsRGBProfile();
@@ -1913,6 +1914,9 @@ gfxPlatform::GetCMSRGBTransform()
gCMSRGBTransform = qcms_transform_create(inProfile, QCMS_DATA_RGB_8,
outProfile, QCMS_DATA_RGB_8,
QCMS_INTENT_PERCEPTUAL);
+ if (!gCMSRGBTransform) {
+ gCMSRGBTransformFailed = true;
+ }
}
return gCMSRGBTransform;