[Libreoffice-commits] core.git: filter/source sd/qa

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 24 07:33:53 UTC 2021


 filter/source/graphicfilter/icgm/class4.cxx |   18 ++++++++++++------
 sd/qa/unit/data/cgm/pass/ofz-ubsan-2.cgm    |binary
 2 files changed, 12 insertions(+), 6 deletions(-)

New commits:
commit 253c8adddb04529185c74aef5e5278eb71d309ab
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 23 17:24:14 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 24 09:33:18 2021 +0200

    ofz: cgm Integer-overflow
    
    Change-Id: I1cb1d5612f2b0b8999fed0d6c203ab24eedd4fe8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120898
    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 04b8f7c6fb63..2129a0f96bcb 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -543,12 +543,18 @@ void CGM::ImplDoClass4()
 
                     if ( mbFigure )
                     {
-                        tools::Rectangle aBoundingBox(aCenter.X - aRadius.X, aCenter.Y - aRadius.X);
-                        aBoundingBox.SaturatingSetSize(Size(2 * aRadius.X, 2 * aRadius.X));
-                        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 );
-                        mpOutAct->RegPolyLine( aPolygon );
+                        double fLeft = aCenter.X - aRadius.X;
+                        double fTop = aCenter.Y - aRadius.X;
+                        bUseless = useless(fLeft) || useless(fTop);
+                        if (!bUseless)
+                        {
+                            tools::Rectangle aBoundingBox(fLeft, fTop);
+                            aBoundingBox.SaturatingSetSize(Size(2 * aRadius.X, 2 * aRadius.X));
+                            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 );
+                            mpOutAct->RegPolyLine( aPolygon );
+                        }
                     }
                     else
                     {
diff --git a/sd/qa/unit/data/cgm/pass/ofz-ubsan-2.cgm b/sd/qa/unit/data/cgm/pass/ofz-ubsan-2.cgm
new file mode 100644
index 000000000000..08692230b903
Binary files /dev/null and b/sd/qa/unit/data/cgm/pass/ofz-ubsan-2.cgm differ


More information about the Libreoffice-commits mailing list