diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-09-10 20:38:12 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-09-14 01:17:09 +0400 |
commit | db91b17963d67988324abac390a1dd72287ae0c3 (patch) | |
tree | 91aec1279b3a0de9c1366f7999c51022e5dbef77 /src/thirdparty/lcms2 | |
parent | 2079768c8e5e5dbd4a6ff8b73957d22c0aadec6a (diff) |
update Little CMS (728139a)
Diffstat (limited to 'src/thirdparty/lcms2')
-rw-r--r-- | src/thirdparty/lcms2/ChangeLog | 4 | ||||
-rw-r--r-- | src/thirdparty/lcms2/src/cmslut.c | 13 | ||||
-rw-r--r-- | src/thirdparty/lcms2/src/cmsopt.c | 40 |
3 files changed, 41 insertions, 16 deletions
diff --git a/src/thirdparty/lcms2/ChangeLog b/src/thirdparty/lcms2/ChangeLog index 970736119..4b2a44486 100644 --- a/src/thirdparty/lcms2/ChangeLog +++ b/src/thirdparty/lcms2/ChangeLog @@ -81,6 +81,8 @@ Fixed a bug in transicc when clot tables are present Added formatter resolution after xform optimization plugin
added half float variants (ABGR and so)
Fixed a bug in XYZ floating point PCS
+Fixed an unitialized read on PatchLUT
+Added a check for maximum input channels
2.4 Featured release
---------------------
\ No newline at end of file +--------------------
diff --git a/src/thirdparty/lcms2/src/cmslut.c b/src/thirdparty/lcms2/src/cmslut.c index 11f6983a1..c970c91c0 100644 --- a/src/thirdparty/lcms2/src/cmslut.c +++ b/src/thirdparty/lcms2/src/cmslut.c @@ -544,6 +544,13 @@ cmsStage* CMSEXPORT cmsStageAllocCLut16bitGranular(cmsContext ContextID, _cmsStageCLutData* NewElem;
cmsStage* NewMPE;
+ _cmsAssert(clutPoints != NULL);
+
+ if (inputChan > MAX_INPUT_DIMENSIONS) {
+ cmsSignalError(ContextID, cmsERROR_RANGE, "Too many input channels (%d channels, max=%d)", inputChan, MAX_INPUT_DIMENSIONS);
+ return NULL;
+ }
+
NewMPE = _cmsStageAllocPlaceholder(ContextID, cmsSigCLutElemType, inputChan, outputChan,
EvaluateCLUTfloatIn16, CLUTElemDup, CLutElemTypeFree, NULL );
@@ -631,6 +638,11 @@ cmsStage* CMSEXPORT cmsStageAllocCLutFloatGranular(cmsContext ContextID, const c _cmsAssert(clutPoints != NULL);
+ if (inputChan > MAX_INPUT_DIMENSIONS) {
+ cmsSignalError(ContextID, cmsERROR_RANGE, "Too many input channels (%d channels, max=%d)", inputChan, MAX_INPUT_DIMENSIONS);
+ return NULL;
+ }
+
NewMPE = _cmsStageAllocPlaceholder(ContextID, cmsSigCLutElemType, inputChan, outputChan,
EvaluateCLUTfloat, CLUTElemDup, CLutElemTypeFree, NULL);
if (NewMPE == NULL) return NULL;
@@ -666,7 +678,6 @@ cmsStage* CMSEXPORT cmsStageAllocCLutFloatGranular(cmsContext ContextID, const c }
-
NewElem ->Params = _cmsComputeInterpParamsEx(ContextID, clutPoints, inputChan, outputChan, NewElem ->Tab.TFloat, CMS_LERP_FLAGS_FLOAT);
if (NewElem ->Params == NULL) {
cmsStageFree(NewMPE);
diff --git a/src/thirdparty/lcms2/src/cmsopt.c b/src/thirdparty/lcms2/src/cmsopt.c index f5dd87975..111a6547e 100644 --- a/src/thirdparty/lcms2/src/cmsopt.c +++ b/src/thirdparty/lcms2/src/cmsopt.c @@ -389,17 +389,17 @@ cmsBool PatchLUT(cmsStage* CLUT, cmsUInt16Number At[], cmsUInt16Number Value[], return FALSE;
}
- px = ((cmsFloat64Number) At[0] * (p16->Domain[0])) / 65535.0;
- py = ((cmsFloat64Number) At[1] * (p16->Domain[1])) / 65535.0;
- pz = ((cmsFloat64Number) At[2] * (p16->Domain[2])) / 65535.0;
- pw = ((cmsFloat64Number) At[3] * (p16->Domain[3])) / 65535.0;
+ if (nChannelsIn == 4) {
- x0 = (int) floor(px);
- y0 = (int) floor(py);
- z0 = (int) floor(pz);
- w0 = (int) floor(pw);
+ px = ((cmsFloat64Number) At[0] * (p16->Domain[0])) / 65535.0;
+ py = ((cmsFloat64Number) At[1] * (p16->Domain[1])) / 65535.0;
+ pz = ((cmsFloat64Number) At[2] * (p16->Domain[2])) / 65535.0;
+ pw = ((cmsFloat64Number) At[3] * (p16->Domain[3])) / 65535.0;
- if (nChannelsIn == 4) {
+ x0 = (int) floor(px);
+ y0 = (int) floor(py);
+ z0 = (int) floor(pz);
+ w0 = (int) floor(pw);
if (((px - x0) != 0) ||
((py - y0) != 0) ||
@@ -407,24 +407,36 @@ cmsBool PatchLUT(cmsStage* CLUT, cmsUInt16Number At[], cmsUInt16Number Value[], ((pw - w0) != 0)) return FALSE; // Not on exact node
index = p16 -> opta[3] * x0 +
- p16 -> opta[2] * y0 +
- p16 -> opta[1] * z0 +
- p16 -> opta[0] * w0;
+ p16 -> opta[2] * y0 +
+ p16 -> opta[1] * z0 +
+ p16 -> opta[0] * w0;
}
else
if (nChannelsIn == 3) {
+ px = ((cmsFloat64Number) At[0] * (p16->Domain[0])) / 65535.0;
+ py = ((cmsFloat64Number) At[1] * (p16->Domain[1])) / 65535.0;
+ pz = ((cmsFloat64Number) At[2] * (p16->Domain[2])) / 65535.0;
+
+ x0 = (int) floor(px);
+ y0 = (int) floor(py);
+ z0 = (int) floor(pz);
+
if (((px - x0) != 0) ||
((py - y0) != 0) ||
((pz - z0) != 0)) return FALSE; // Not on exact node
index = p16 -> opta[2] * x0 +
- p16 -> opta[1] * y0 +
- p16 -> opta[0] * z0;
+ p16 -> opta[1] * y0 +
+ p16 -> opta[0] * z0;
}
else
if (nChannelsIn == 1) {
+ px = ((cmsFloat64Number) At[0] * (p16->Domain[0])) / 65535.0;
+
+ x0 = (int) floor(px);
+
if (((px - x0) != 0)) return FALSE; // Not on exact node
index = p16 -> opta[0] * x0;
|