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

Caolán McNamara caolanm at redhat.com
Sat Apr 14 16:23:47 UTC 2018


 filter/source/msfilter/msdffimp.cxx |    8 ++++----
 oox/source/drawingml/shape.cxx      |    5 +++--
 2 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 9bb6ed114c1b23ecde1df02d954a3bb1abb17e49
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Apr 14 14:19:52 2018 +0100

    ofz#7624 Integer-overflow
    
    Change-Id: Ie7a5ff4d6477bca27b83179559664e751817a608
    Reviewed-on: https://gerrit.libreoffice.org/52870
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 9f92e7e7eecd..3aac4273fc4c 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -33,6 +33,7 @@
 #include <oox/drawingml/chart/chartconverter.hxx>
 #include <drawingml/chart/chartspacefragment.hxx>
 #include <drawingml/chart/chartspacemodel.hxx>
+#include <o3tl/safeint.hxx>
 #include <oox/ppt/pptimport.hxx>
 #include <oox/vml/vmldrawing.hxx>
 #include <oox/vml/vmlshape.hxx>
@@ -431,12 +432,12 @@ Reference< XShape > const & Shape::createAndInsert(
         maSize.Width = 0;
         for (auto const& elem : mpTablePropertiesPtr->getTableGrid())
         {
-            maSize.Width += elem;
+            maSize.Width = o3tl::saturating_add(maSize.Width, static_cast<sal_Int32>(elem));
         }
         maSize.Height = 0;
         for (auto const& elem : mpTablePropertiesPtr->getTableRows())
         {
-            maSize.Height += elem.getHeight();
+            maSize.Height = o3tl::saturating_add(maSize.Height, elem.getHeight());
         }
     }
 
commit 21e84c0935926e6c2a0bf772d41a4c41df70fd7a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Apr 14 14:27:12 2018 +0100

    ofz#7671 Undefined-shift
    
    Change-Id: Ibcd35914bac8799e6b0d48b5c7413b6ad11b9498
    Reviewed-on: https://gerrit.libreoffice.org/52871
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index e958c813068c..82db02739223 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1932,7 +1932,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
         if (bImport)
         {
             uno::Sequence< beans::PropertyValues > aHandles( nNumElem );
-            for ( sal_uInt16 i = 0; i < nNumElem; i++ )
+            for (sal_uInt32 i = 0; i < nNumElem; ++i)
             {
                 PropVec aHandlePropVec;
                 sal_uInt32 nFlagsTmp(0);
@@ -1987,7 +1987,7 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
                     if ( nCenterY == 2 )
                         nCenterY = nCoordHeight / 2;
                     if ( ( nPositionY >= 0x256 ) || ( nPositionY <= 0x107 ) )   // position y
-                        nAdjustmentsWhichNeedsToBeConverted |= ( 1 << i );
+                        nAdjustmentsWhichNeedsToBeConverted |= ( 1U << i );
                     EnhancedCustomShapeParameterPair aPolar;
                     EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPolar.First,  nCenterX, bool( nFlags & SvxMSDffHandleFlags::CENTER_X_IS_SPECIAL ), true  );
                     EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPolar.Second, nCenterY, bool( nFlags & SvxMSDffHandleFlags::CENTER_Y_IS_SPECIAL ), false );
@@ -2104,14 +2104,14 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
         const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( rObjData.eShapeType );
         if ( pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles )
         {
-            sal_Int32 i, nCnt = pDefCustomShape->nHandles;
+            sal_uInt32 i, nCnt = pDefCustomShape->nHandles;
             const SvxMSDffHandle* pData = pDefCustomShape->pHandles;
             for ( i = 0; i < nCnt; i++, pData++ )
             {
                 if ( pData->nFlags & SvxMSDffHandleFlags::POLAR )
                 {
                     if ( ( pData->nPositionY >= 0x256 ) || ( pData->nPositionY <= 0x107 ) )
-                        nAdjustmentsWhichNeedsToBeConverted |= ( 1 << i );
+                        nAdjustmentsWhichNeedsToBeConverted |= ( 1U << i );
                 }
             }
         }


More information about the Libreoffice-commits mailing list