Commit 14ee7638 authored by Boudewijn Rempt's avatar Boudewijn Rempt

CID 34789: Division or modulo by float zero (DIVIDE_BY_ZERO)

6. divide_by_zero: In expression yradius / (double)xradius, division by
expression xradius which may be zero has undefined behavior.
parent d47d7885
......@@ -59,7 +59,11 @@ void KisSelectionFilter::computeBorder(qint32* circ, qint32 xradius, qint32 yrad
else
tmp = 0.0;
circ[i] = (qint32) RINT(yradius / (double) xradius * sqrt(xradius * xradius - tmp * tmp));
double divisor = (double) xradius * sqrt(xradius * xradius - tmp * tmp);
if (divisor == 0.0) {
divisor = 1.0;
}
circ[i] = (qint32) RINT(yradius / divisor);
}
}
......
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