[Libreoffice-commits] core.git: 2 commits - filter/source sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 30 19:39:16 UTC 2021


 filter/source/graphicfilter/icgm/class4.cxx |   33 ++++++++++++++++++++++------
 sc/source/filter/lotus/op.cxx               |    2 -
 2 files changed, 27 insertions(+), 8 deletions(-)

New commits:
commit c93f941be682d767636110ab10da9a55833370f4
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 30 15:15:24 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Aug 30 21:38:57 2021 +0200

    ofz#37831 avoid Integer-overflow
    
    Change-Id: I95acce44623c6c5e48686a79314ffaf6ab402292
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121317
    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 7fdd13455f68..7561e2240576 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -422,13 +422,32 @@ void CGM::ImplDoClass4()
 
                     if ( mbFigure )
                     {
-                        tools::Rectangle aBoundingBox(aCenterPoint.X - fRadius, aCenterPoint.Y - fRadius);
-                        aBoundingBox.SaturatingSetSize(Size(2 * fRadius, 2 * fRadius));
-                        tools::Polygon aPolygon( aBoundingBox, Point( static_cast<tools::Long>(aStartingPoint.X), static_cast<tools::Long>(aStartingPoint.Y) ) ,Point( static_cast<tools::Long>(aEndingPoint.X), static_cast<tools::Long>(aEndingPoint.Y) ), PolyStyle::Arc );
-                        if ( nSwitch )
-                            mpOutAct->RegPolyLine( aPolygon, true );
-                        else
-                            mpOutAct->RegPolyLine( aPolygon );
+                        double fLeft = aCenterPoint.X - fRadius;
+                        double fTop = aCenterPoint.Y - fRadius;
+                        double fRight = fLeft + (2 * fRadius);
+                        double fBottom = fTop + (2 * fRadius);
+                        bUseless = useless(fLeft) || useless(fTop) || useless(fRight) || useless(fBottom);
+                        if (!bUseless)
+                        {
+                            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>(aStartingPoint.X), static_cast<tools::Long>(aStartingPoint.Y) ) ,Point( static_cast<tools::Long>(aEndingPoint.X), static_cast<tools::Long>(aEndingPoint.Y) ), PolyStyle::Arc );
+                            if ( nSwitch )
+                                mpOutAct->RegPolyLine( aPolygon, true );
+                            else
+                                mpOutAct->RegPolyLine( aPolygon );
+                        }
                     }
                     else
                     {
commit 31d0b43edfc304b7d69adb49ab8e5892726ed0cb
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 30 17:07:23 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Aug 30 21:38:42 2021 +0200

    make this more readable
    
    Change-Id: I031054d3a6929c48b796ce527448d2c5a5099a8b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121319
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index b245e0f04987..4f9ed6e2679b 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -244,7 +244,7 @@ void OP_SymphNamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
 
     r.ReadUInt16( nColSt ).ReadUInt16( nRowSt ).ReadUInt16( nColEnd ).ReadUInt16( nRowEnd ).ReadUChar( nType );
 
-    if (!(rContext.rDoc.ValidColRow( static_cast<SCCOL>(nColSt), nRowSt) && rContext.rDoc.ValidColRow( static_cast<SCCOL>(nColEnd), nRowEnd)))
+    if (!rContext.rDoc.ValidColRow(static_cast<SCCOL>(nColSt), nRowSt) || !rContext.rDoc.ValidColRow(static_cast<SCCOL>(nColEnd), nRowEnd))
         return;
 
     std::unique_ptr<LotusRange> pRange;


More information about the Libreoffice-commits mailing list