[Libreoffice-commits] core.git: filter/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 27 07:28:45 UTC 2021
filter/source/graphicfilter/icgm/class4.cxx | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
New commits:
commit 1748ebf646b22278a618534823a10933ce0f5fa1
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Aug 26 17:18:02 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Aug 27 09:28:11 2021 +0200
ofz: Integer-overflow
Change-Id: I4142f48db0f756872ea75e1c39cda6195bdddf43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121127
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
index 2129a0f96bcb..7fdd13455f68 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -24,6 +24,7 @@
#include "elements.hxx"
#include "outact.hxx"
+#include <o3tl/float_int_conversion.hxx>
#include <o3tl/safeint.hxx>
#include <memory>
@@ -545,11 +546,24 @@ void CGM::ImplDoClass4()
{
double fLeft = aCenter.X - aRadius.X;
double fTop = aCenter.Y - aRadius.X;
- bUseless = useless(fLeft) || useless(fTop);
+ double fRight = fLeft + (2 * aRadius.X);
+ double fBottom = fTop + (2 * aRadius.X);
+ bUseless = useless(fLeft) || useless(fTop) || useless(fRight) || useless(fBottom);
if (!bUseless)
{
- tools::Rectangle aBoundingBox(fLeft, fTop);
- aBoundingBox.SaturatingSetSize(Size(2 * aRadius.X, 2 * aRadius.X));
+ double fWidth = fLeft + fRight;
+ bUseless = !o3tl::convertsToAtLeast(fWidth, std::numeric_limits<tools::Long>::min()) ||
+ !o3tl::convertsToAtMost(fWidth, std::numeric_limits<tools::Long>::max());
+ }
+ if (!bUseless)
+ {
+ double fHeight = fTop + fBottom;
+ bUseless = !o3tl::convertsToAtLeast(fHeight, std::numeric_limits<tools::Long>::min()) ||
+ !o3tl::convertsToAtMost(fHeight, std::numeric_limits<tools::Long>::max());
+ }
+ if (!bUseless)
+ {
+ tools::Rectangle aBoundingBox(fLeft, fTop, fRight, fBottom);
tools::Polygon aPolygon( aBoundingBox,
Point( static_cast<tools::Long>(vector[ 0 ]), static_cast<tools::Long>(vector[ 1 ]) ),
Point( static_cast<tools::Long>(vector[ 2 ]), static_cast<tools::Long>(vector[ 3 ]) ), PolyStyle::Arc );
More information about the Libreoffice-commits
mailing list