summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarti Maria <info@littlecms.com>2010-06-26 17:24:27 +0200
committerMarti Maria <info@littlecms.com>2010-06-26 17:24:27 +0200
commite6bfe8c3ef7c15d32ddaadc451efe0eb1cd7f1e4 (patch)
tree0c577b0f09cd67e9bf88b3af9f4a91d9f7251111 /src
parent27472a133542425eaf86a993bbecaa82e9f6d718 (diff)
downloadlcms2-e6bfe8c3ef7c15d32ddaadc451efe0eb1cd7f1e4.tar.gz
Fixed NULL offset on matrix element makes crash on saving, VCGT ill-formed profiles
Diffstat (limited to 'src')
-rw-r--r--src/cmstypes.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cmstypes.c b/src/cmstypes.c
index 6ef1f26..3bf2ee8 100644
--- a/src/cmstypes.c
+++ b/src/cmstypes.c
@@ -2442,9 +2442,19 @@ cmsBool WriteMatrix(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cms
if (!_cmsWrite15Fixed16Number(io, m -> Double[7])) return FALSE;
if (!_cmsWrite15Fixed16Number(io, m -> Double[8])) return FALSE;
+ if (m ->Offset != NULL) {
+
if (!_cmsWrite15Fixed16Number(io, m -> Offset[0])) return FALSE;
if (!_cmsWrite15Fixed16Number(io, m -> Offset[1])) return FALSE;
if (!_cmsWrite15Fixed16Number(io, m -> Offset[2])) return FALSE;
+ }
+ else {
+ if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE;
+ if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE;
+ if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE;
+
+ }
+
return TRUE;
@@ -4467,6 +4477,11 @@ void *Type_vcgt_Read(struct _cms_typehandler_struct* self,
if (!_cmsReadUInt16Number(io, &nElems)) goto Error;
if (!_cmsReadUInt16Number(io, &nBytes)) goto Error;
+ // Adobe's quirk fixup. Fixing broken profiles...
+ if (nElems == 256 && nBytes == 1 && SizeOfTag == 1576)
+ nBytes = 2;
+
+
// Populate tone curves
for (n=0; n < 3; n++) {