Commit 5b4a6624 authored by Boudewijn Rempt's avatar Boudewijn Rempt

CID:249016: Division or modulo by zero

(DIVIDE_BY_ZERO)12. divide_by_zero: In function call divide, division
by expression newDstAlpha which may be zero has undefined behavior.
parent 443ace73
......@@ -83,7 +83,9 @@ public:
channels_type dstMult = mul(dst[channel], dstAlpha);
channels_type srcMult = mul(src[channel], unitValue<channels_type>());
channels_type blendedValue = lerp(dstMult, srcMult, scale<channels_type>(fakeOpacity));
// CID 249016 (#1 of 15):
// Division or modulo by zero (DIVIDE_BY_ZERO)12. divide_by_zero: In function call divide, division by expression newDstAlpha which may be zero has undefined behavior.
if (newDstAlpha == 0) newDstAlpha = 1;
composite_type normedValue = KoColorSpaceMaths<channels_type>::divide(blendedValue, newDstAlpha);
dst[channel] = KoColorSpaceMaths<channels_type>::clampAfterScale(normedValue);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment