summaryrefslogtreecommitdiff
path: root/tools/source/generic
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-08-30 09:49:21 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-08-30 11:52:00 +0200
commit70e0b2ab2cfb45f7eaa08337a42546f9c9f94542 (patch)
treed6320b4aa0856c2a817156c6a5a39f4ae6b5fc3a /tools/source/generic
parent5a16cd1123003d6f72d84983292cf96c7fb49d60 (diff)
ofz#50761 Integer-overflow
Change-Id: I8681e7b1b128e7ca33142b7120ad2d4bb3227493 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139019 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'tools/source/generic')
-rw-r--r--tools/source/generic/line.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/source/generic/line.cxx b/tools/source/generic/line.cxx
index 26465c5c85d6..1112da9863c2 100644
--- a/tools/source/generic/line.cxx
+++ b/tools/source/generic/line.cxx
@@ -49,17 +49,17 @@ bool Line::Intersection( const Line& rLine, Point& rIntersection ) const
bool Line::Intersection( const tools::Line& rLine, double& rIntersectionX, double& rIntersectionY ) const
{
- const double fAx = maEnd.X() - maStart.X();
- const double fAy = maEnd.Y() - maStart.Y();
- const double fBx = rLine.maStart.X() - rLine.maEnd.X();
- const double fBy = rLine.maStart.Y() - rLine.maEnd.Y();
+ const double fAx = static_cast<double>(maEnd.X()) - maStart.X();
+ const double fAy = static_cast<double>(maEnd.Y()) - maStart.Y();
+ const double fBx = static_cast<double>(rLine.maStart.X()) - rLine.maEnd.X();
+ const double fBy = static_cast<double>(rLine.maStart.Y()) - rLine.maEnd.Y();
const double fDen = fAy * fBx - fAx * fBy;
bool bOk = false;
if( fDen != 0. )
{
- const double fCx = maStart.X() - rLine.maStart.X();
- const double fCy = maStart.Y() - rLine.maStart.Y();
+ const double fCx = static_cast<double>(maStart.X()) - rLine.maStart.X();
+ const double fCy = static_cast<double>(maStart.Y()) - rLine.maStart.Y();
const double fA = fBy * fCx - fBx * fCy;
const bool bGreater = ( fDen > 0. );