summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-10-07 09:20:01 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-10-07 15:49:16 +0200
commitf59911c4381ca066facd0dcc6b1037077f4fc90a (patch)
tree5758534246473692fe5d093428dc37b7f10eb2f1 /tools
parent84e9a0056967d5c641ec63bf6a4dc6c0f2798e3d (diff)
ofz#52191 Integer-overflow
Change-Id: I97daf9327c55229fe7da546164d398353e0696a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141046 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/generic/line.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/source/generic/line.cxx b/tools/source/generic/line.cxx
index 1112da9863c2..ee9ad979793c 100644
--- a/tools/source/generic/line.cxx
+++ b/tools/source/generic/line.cxx
@@ -104,13 +104,13 @@ double Line::GetDistance( const double& rPtX, const double& rPtY ) const
if( maStart != maEnd )
{
- const double fDistX = maEnd.X() - maStart.X();
- const double fDistY = maEnd.Y() - maStart.Y();
- const double fACX = maStart.X() - rPtX;
- const double fACY = maStart.Y() - rPtY;
- const double fL2 = fDistX * fDistX + fDistY * fDistY;
- const double fR = ( fACY * -fDistY - fACX * fDistX ) / fL2;
- const double fS = ( fACY * fDistX - fACX * fDistY ) / fL2;
+ const double fDistX = static_cast<double>(maEnd.X()) - maStart.X();
+ const double fDistY = static_cast<double>(maEnd.Y()) - maStart.Y();
+ const double fACX = static_cast<double>(maStart.X()) - rPtX;
+ const double fACY = static_cast<double>(maStart.Y()) - rPtY;
+ const double fL2 = fDistX * fDistX + fDistY * fDistY;
+ const double fR = ( fACY * -fDistY - fACX * fDistX ) / fL2;
+ const double fS = ( fACY * fDistX - fACX * fDistY ) / fL2;
if( fR < 0.0 )
{