[Libreoffice-commits] core.git: 4 commits - filter/source sc/inc sc/qa sc/source sw/source

Caolán McNamara caolanm at redhat.com
Thu Jan 11 20:30:32 UTC 2018


 filter/source/msfilter/msdffimp.cxx |   13 ++++++++++---
 sc/inc/document.hxx                 |    5 -----
 sc/qa/unit/ucalc.cxx                |    1 -
 sc/source/core/data/documen2.cxx    |    1 -
 sc/source/core/data/formulacell.cxx |    5 -----
 sc/source/core/tool/interpr7.cxx    |    9 +++++++++
 sw/source/filter/html/svxcss1.cxx   |   12 ++++++++----
 7 files changed, 27 insertions(+), 19 deletions(-)

New commits:
commit 34bbe8f858fd992c784586b839c0f1dc8a218b4a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 10 14:27:35 2018 +0000

    limit WEBSERVICE to http[s] protocols
    
    and like excel...
    
    'For protocols that aren’t supported, such as ftp:// or file://, WEBSERVICE
    returns the #VALUE! error value.'
    
    Change-Id: I0e9c6fd3426fad56a199eafac48de9b0f23914b3
    Reviewed-on: https://gerrit.libreoffice.org/47709
    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/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index b92bf8cccf22..863664cc5309 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -14,6 +14,7 @@
 #include <rtl/strbuf.hxx>
 #include <formula/errorcodes.hxx>
 #include <svtools/miscopt.hxx>
+#include <tools/urlobj.hxx>
 
 #include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
 #include <com/sun/star/ucb/SimpleFileAccess.hpp>
@@ -247,6 +248,14 @@ void ScInterpreter::ScWebservice()
             return;
         }
 
+        INetURLObject aObj(aURI, INetProtocol::File);
+        INetProtocol eProtocol = aObj.GetProtocol();
+        if (eProtocol != INetProtocol::Http && eProtocol != INetProtocol::Https)
+        {
+            PushError( FormulaError::NoValue );
+            return;
+        }
+
         uno::Reference< ucb::XSimpleFileAccess3 > xFileAccess( ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext() ), uno::UNO_QUERY );
         if(!xFileAccess.is())
         {
commit dddb683300a0ce0fd713c924ebd9e005df60fea9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 11 17:28:06 2018 +0000

    ofz#5248 Integer-overflow
    
    Change-Id: I7cefb6cb37370ed41c42dfc4fafa81b64e0709d6
    Reviewed-on: https://gerrit.libreoffice.org/47771
    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 ac7de6b6034f..a54ee36f8c0f 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3862,9 +3862,16 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
                 nContrast = 0;
             else
             {
-                nContrast *= 101;   //100 + 1 to round
-                nContrast /= 0x10000;
-                nContrast -= 100;
+                if (o3tl::checked_multiply(nContrast, 101, nContrast))  //100 + 1 to round
+                {
+                    SAL_WARN("filter.ms", "bad Contrast value:" << nContrast);
+                    nContrast = 0;
+                }
+                else
+                {
+                    nContrast /= 0x10000;
+                    nContrast -= 100;
+                }
             }
             sal_Int16   nBrightness     = (sal_Int16)( (sal_Int32)GetPropertyValue( DFF_Prop_pictureBrightness, 0 ) / 327 );
             sal_Int32   nGamma          = GetPropertyValue( DFF_Prop_pictureGamma, 0x10000 );
commit 7ab38075345215879d923b3d93843cdbcf2db005
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 11 17:07:32 2018 +0000

    ofz#5247 Integer-overflow
    
    Change-Id: I333f8bb2d7168f43d7d85c48dd39c6ed02ca970d
    Reviewed-on: https://gerrit.libreoffice.org/47769
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index e442644271f2..c8049583e65b 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -1653,10 +1653,14 @@ static void ParseCSS1_line_height( const CSS1Expression *pExpr,
         break;
     case CSS1_PIXLENGTH:
         {
-            long nPWidth = 0;
-            long nPHeight = (long)pExpr->GetNumber();
-            SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
-            nHeight = (sal_uInt16)nPHeight;
+            double fHeight = pExpr->GetNumber();
+            if (fHeight < SAL_MAX_INT32/2.0 && fHeight > SAL_MIN_INT32/2.0)
+            {
+                long nPHeight = (long)fHeight;
+                long nPWidth = 0;
+                SvxCSS1Parser::PixelToTwip(nPWidth, nPHeight);
+                nHeight = (sal_uInt16)nPHeight;
+            }
         }
         break;
     case CSS1_PERCENTAGE:
commit b0597ba5d745974fce752e1b677451a19350d351
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 11 14:16:15 2018 +0000

    only call GetHasMacroFunc to set SetHasMacroFunc
    
    and bHasMacroFunc is not accessed any other way, so this is an oxbow
    
    Change-Id: Iada84c1c4cbc2a914b78693347fa1a3521c85e6d
    Reviewed-on: https://gerrit.libreoffice.org/47757
    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/sc/inc/document.hxx b/sc/inc/document.hxx
index 834783c0bff3..3d13fd4d649f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -500,8 +500,6 @@ private:
     // for detective update, is set for each change of a formula
     bool                bDetectiveDirty;
 
-    bool                bHasMacroFunc;      // valid only after loading
-
     CharCompressType    nAsianCompression;
     sal_uInt8           nAsianKerning;
 
@@ -1990,9 +1988,6 @@ public:
     bool            IsDetectiveDirty() const     { return bDetectiveDirty; }
     void            SetDetectiveDirty(bool bSet) { bDetectiveDirty = bSet; }
 
-    bool            GetHasMacroFunc() const      { return bHasMacroFunc; }
-    void            SetHasMacroFunc(bool bSet)   { bHasMacroFunc = bSet; }
-
     void            SetRangeOverflowType(ErrCode nType)  { nRangeOverflowType = nType; }
     bool            HasRangeOverflow() const             { return nRangeOverflowType != ERRCODE_NONE; }
     SC_DLLPUBLIC const ErrCode& GetRangeOverflowType() const    { return nRangeOverflowType; }
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 6c21736a19b0..36572e564cb5 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -6548,7 +6548,6 @@ void Test::testEmptyCalcDocDefaults()
     CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IdleCalcTextWidth() );
     CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsIdleEnabled() );
     CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsDetectiveDirty() );
-    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->GetHasMacroFunc() );
     CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsChartListenerCollectionNeedsUpdate() );
 
     CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasRangeOverflow() );
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 373e3f6b73b2..bd0f72e76658 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -203,7 +203,6 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
         bInDtorClear( false ),
         bExpandRefs( false ),
         bDetectiveDirty( false ),
-        bHasMacroFunc( false ),
         nAsianCompression(CharCompressType::Invalid),
         nAsianKerning(SC_ASIANKERNING_INVALID),
         bPastingDrawFromOtherDoc( false ),
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index d46bf53cb8c3..efab5fa09cf3 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1358,11 +1358,6 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
             bChanged = true;
     }
 
-    //  Same as in Load: after loading, it must be known if ocMacro is in any formula
-    //  (for macro warning, CompileXML is called at the end of loading XML file)
-    if ( !pDocument->GetHasMacroFunc() && pCode->HasOpCodeRPN( ocMacro ) )
-        pDocument->SetHasMacroFunc( true );
-
     //volatile cells must be added here for import
     if( pCode->IsRecalcModeAlways() || pCode->IsRecalcModeForced() ||
         pCode->IsRecalcModeOnLoad() || pCode->IsRecalcModeOnLoadOnce() )


More information about the Libreoffice-commits mailing list