Skip to content

Commit 186bba0

Browse files
authored
Fix: HBO in CIccCalculatorFunc::InitSelectOp() (#622)
Signed-off-by: David Hoyt <dhoyt@hoyt.net>
1 parent cf28ef4 commit 186bba0

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

IccProfLib/IccMpeCalc.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3658,10 +3658,12 @@ bool CIccCalculatorFunc::InitSelectOp(SIccCalcOp *ops, icUInt32Number nOps)
36583658
if (ops->extra)
36593659
return true;
36603660

3661-
36623661
icUInt32Number i, n, pos;
3663-
for (n=0; n<nOps && ops[n+1].sig==icSigCaseOp; n++);
3664-
ops->extra=n;
3662+
for (n=0; n<(nOps-1) && ops[n+1].sig==icSigCaseOp; n++);
3663+
if (n >= (nOps-1)) // there are no operations after the cases, and we don't want a segfault
3664+
return false;
3665+
3666+
ops->extra = n;
36653667
if (ops[n+1].sig==icSigDefaultOp) {
36663668
n++;
36673669
}

0 commit comments

Comments
 (0)