[Libreoffice-commits] core.git: Branch 'feature/cib_contract891' - 20 commits - external/boost external/harfbuzz include/basebmp include/formula include/sfx2 librelogo/source scripting/source sfx2/source solenv/gbuild sw/qa vcl/source vcl/unx

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 28 13:50:21 UTC 2019


 external/boost/UnpackedTarball_boost.mk            |    1 
 external/boost/boost-shared_ptr-bool.patch.1       |   11 ++++
 external/harfbuzz/ExternalProject_harfbuzz.mk      |    1 
 include/basebmp/packedpixeliterator.hxx            |    8 ++-
 include/formula/grammar.hxx                        |    2 
 include/sfx2/objsh.hxx                             |    2 
 librelogo/source/LibreLogo/LibreLogo.py            |   51 ++++++++++++++++++++
 scripting/source/protocolhandler/scripthandler.cxx |    9 ++-
 scripting/source/pyprov/pythonscript.py            |   21 +++++++-
 sfx2/source/doc/objmisc.cxx                        |   52 ++++++++++++++++++---
 sfx2/source/notify/eventsupplier.cxx               |   18 ++++---
 solenv/gbuild/platform/unxgcc.mk                   |    1 
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx           |    8 +--
 vcl/source/glyphs/graphite_layout.cxx              |   16 +++---
 vcl/unx/gtk/app/gtksys.cxx                         |   23 ++++++---
 15 files changed, 185 insertions(+), 39 deletions(-)

New commits:
commit 74b472bf74037e9ed20a15e6c7da3d77c27195fc
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Aug 26 10:18:09 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:28:20 2019 +0200

    Improve check
    
    Change-Id: I8280a81eef2ced0ff0ace51ea9f094421abafe13
    Reviewed-on: https://gerrit.libreoffice.org/78108
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 761e6dd25782420bf06e4a2ff3205a79b6cbb136)
    Reviewed-on: https://gerrit.libreoffice.org/78129
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit ffad51e9e625a22f1efab3da7886baf4134b444f)
    (cherry picked from commit be67954c84f099ff55e8b7c0480c43477ebb1ffa)

diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 23d0050bbafb..0f428e8e0ad2 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1530,7 +1530,7 @@ bool SfxObjectShell::UnTrustedScript(const OUString& rScriptURL)
     do
     {
         OUString aToken = sScript.getToken(0, '/', nIndex);
-        if (aToken.startsWithIgnoreAsciiCase("LibreLogo"))
+        if (aToken.startsWithIgnoreAsciiCase("LibreLogo") || aToken.indexOf('~') != -1)
         {
             return true;
         }
commit 5eae3126b5aeeeb06fa2a1e266f0af41084e1135
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Aug 19 11:27:15 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:27:42 2019 +0200

    Improve check for absolute URI
    
    Change-Id: I4dee44832107f72f8f3fb68554428dc1e646c346
    Reviewed-on: https://gerrit.libreoffice.org/77706
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit c79efeb66f7951305d0334bc288aee1c571a8728)
    Reviewed-on: https://gerrit.libreoffice.org/77724
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 52f7aa318722bd17c77ee5c4fa8307936e7b53af)
    (cherry picked from commit 5fcd72f856af758bc08a5668cf044c990f36598a)

diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py
index e531069e9898..2e633441c083 100755
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -235,7 +235,7 @@ class MyUriHelper:
                 log.debug( message )
                 raise RuntimeException( message )
 
-            if xFileUri.isAbsolute():
+            if not xFileUri.hasRelativePath():
                 message = "pythonscript: an absolute uri is invalid '" + sFileUri+ "'"
                 log.debug( message )
                 raise RuntimeException( message )
commit b163afb6f8cd25d39d56fb931c020f11b0332246
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Aug 16 10:18:34 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:27:04 2019 +0200

    an absolute uri is invalid input
    
    Change-Id: I392be4282be8ed67e3451b28d2c9f22acd4c87fc
    Reviewed-on: https://gerrit.libreoffice.org/77564
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 3c076e54f736980e208f5c27ecf179aa90aea103)
    Reviewed-on: https://gerrit.libreoffice.org/77572
    Tested-by: Jenkins
    (cherry picked from commit 5445f7ffd09e891b220dabb19cd013bcf591fc08)
    (cherry picked from commit 3796e9e27176fcf55d46ba364322094c8a116efa)

diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py
index 5208a4d7c7d9..e531069e9898 100755
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -235,6 +235,11 @@ class MyUriHelper:
                 log.debug( message )
                 raise RuntimeException( message )
 
+            if xFileUri.isAbsolute():
+                message = "pythonscript: an absolute uri is invalid '" + sFileUri+ "'"
+                log.debug( message )
+                raise RuntimeException( message )
+
             # absolute path to the .py file
             xAbsScriptUri = self.m_uriRefFac.makeAbsolute(xBaseUri, xFileUri, True, RETAIN)
             sAbsScriptUri = xAbsScriptUri.getUriReference()
commit d7cdf0357ca8147d02ec8605e5cd00deaf990c38
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 12 20:32:54 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:24:09 2019 +0200

    construct final url from parsed output
    
    Change-Id: Ifd733625a439685ad307603eb2b00bf463eb9ca9
    Reviewed-on: https://gerrit.libreoffice.org/77373
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 87959e5deea6d33cd35dbb3b8423056f9566710e)
    Reviewed-on: https://gerrit.libreoffice.org/77377
    (cherry picked from commit c03acb9b8a97254cfcf7c45ef920b93b7f1dd344)
    (cherry picked from commit 709ad45fbf4c361b2b4326e190b6b42759d84f32)

diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py
index 6e4c089b7555..5208a4d7c7d9 100755
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -222,7 +222,13 @@ class MyUriHelper:
             sStorageUri = sStorageUri.replace( "|", "/" )
 
             # path to the .py file, relative to the base
-            sFileUri = sStorageUri[0:sStorageUri.find("$")]
+            funcNameStart = sStorageUri.find("$")
+            if funcNameStart != -1:
+                sFileUri = sStorageUri[0:funcNameStart]
+                sFuncName = sStorageUri[funcNameStart+1:]
+            else:
+                sFileUri = sStorageUri
+
             xFileUri = self.m_uriRefFac.parse(sFileUri)
             if not xFileUri:
                 message = "pythonscript: invalid relative uri '" + sFileUri+ "'"
@@ -239,7 +245,9 @@ class MyUriHelper:
                 log.debug( message )
                 raise RuntimeException( message )
 
-            ret = sBaseUri + sStorageUri
+            ret = sAbsScriptUri
+            if funcNameStart != -1:
+                ret = ret + "$" + sFuncName
             log.debug( "converting scriptURI="+scriptURI + " to storageURI=" + ret )
             return ret
         except UnoException as e:
commit ccd9a0fb88704f5794ed13e0956173758c44b517
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 7 12:58:01 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:21:23 2019 +0200

    expand pyuno path separators
    
    Change-Id: Ic97649ed6d4be595b308922c7bdc880cbb60b239
    Reviewed-on: https://gerrit.libreoffice.org/77102
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 75903a0298218f89a199a5ac151ee0166f4469d7)
    (cherry picked from commit 7db4545a37d9833d0e97b98d4904d2238d4e8985)

diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 8f6c1afd7dd7..23d0050bbafb 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1522,7 +1522,8 @@ bool SfxObjectShell::UnTrustedScript(const OUString& rScriptURL)
     if (!sfUri.is())
         return false;
 
-    OUString sScript = sfUri->getName();
+    // pyuno encodes path separator as |
+    OUString sScript = sfUri->getName().replace('|', '/');
 
     // check if any path portion matches LibreLogo and ban it if it does
     sal_Int32 nIndex = 0;
commit fa643763c2b1eb3a9cb8e6c3b3d27b0ef2b84556
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Aug 6 13:29:22 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:21:23 2019 +0200

    Properly obtain location
    
    Reviewed-on: https://gerrit.libreoffice.org/77019
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit a9cde2557242a0c343d99533f3ee032599c66f42)
    Reviewed-on: https://gerrit.libreoffice.org/77023
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 28c6af3ddc283ca9c5712359a9abcb385c1575b4)
    
    (cherry picked from commit b032ba86fe403ceddf77300cec1eefdbdfe1e129)
    
    Change-Id: I9fb0d883a3623394343cd54ef61e5610544198c8

diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index a613d9787f7d..2dd9c7084572 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -51,6 +51,7 @@
 #include "com/sun/star/uri/XUriReference.hpp"
 #include "com/sun/star/uri/UriReferenceFactory.hpp"
 #include "com/sun/star/uri/XVndSunStarScriptUrl.hpp"
+#include <com/sun/star/uri/XVndSunStarScriptUrlReference.hpp>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -145,8 +146,12 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
     {
         try
         {
-            bool bIsDocumentScript = ( aURL.Complete.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "document" ) ) !=-1 );
-                // TODO: isn't this somewhat strange? This should be a test for a location=document parameter, shouldn't it?
+            css::uno::Reference<css::uri::XUriReferenceFactory> urifac(
+                css::uri::UriReferenceFactory::create(m_xContext));
+            css::uno::Reference<css::uri::XVndSunStarScriptUrlReference> uri(
+                urifac->parse(aURL.Complete), css::uno::UNO_QUERY_THROW);
+            auto const loc = uri->getParameter("location");
+            bool bIsDocumentScript = loc == "document";
 
             if ( bIsDocumentScript )
             {
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index a07bc21e27fb..8f6c1afd7dd7 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1545,19 +1545,22 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon
     OSL_TRACE( "in CallXScript" );
     ErrCode nErr = ERRCODE_NONE;
 
-    bool bIsDocumentScript = ( _rScriptURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "location=document" ) ) >= 0 );
-        // TODO: we should parse the URL, and check whether there is a parameter with this name.
-        // Otherwise, we might find too much.
-    if ( bIsDocumentScript && !lcl_isScriptAccessAllowed_nothrow( _rxScriptContext ) )
-        return ERRCODE_IO_ACCESSDENIED;
-
-    if ( UnTrustedScript(_rScriptURL) )
-        return ERRCODE_IO_ACCESSDENIED;
-
     bool bCaughtException = false;
     Any aException;
     try
     {
+        css::uno::Reference<css::uri::XUriReferenceFactory> urifac(
+            css::uri::UriReferenceFactory::create(comphelper::getProcessComponentContext()));
+        css::uno::Reference<css::uri::XVndSunStarScriptUrlReference> uri(
+            urifac->parse(_rScriptURL), css::uno::UNO_QUERY_THROW);
+        auto const loc = uri->getParameter("location");
+        bool bIsDocumentScript = loc == "document";
+        if ( bIsDocumentScript && !lcl_isScriptAccessAllowed_nothrow( _rxScriptContext ) )
+            return ERRCODE_IO_ACCESSDENIED;
+
+        if ( UnTrustedScript(_rScriptURL) )
+            return ERRCODE_IO_ACCESSDENIED;
+
         // obtain/create a script provider
         Reference< provider::XScriptProvider > xScriptProvider;
         Reference< provider::XScriptProviderSupplier > xSPS( _rxScriptContext, UNO_QUERY );
commit 6f86a820308a8bd9135102c4d6764b6fabe99f27
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Aug 3 16:37:48 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:21:23 2019 +0200

    keep name percent-encoded
    
    Change-Id: I470c4b24192c3e3c9b556a9bbb3b084359e0033b
    Reviewed-on: https://gerrit.libreoffice.org/77006
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 315c51731384230194af26b86a976bf5d06c9dcc)
    (cherry picked from commit 102efaffd32f0deaf1868ca50c8aa06d83cc0353)

diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py
index c43d892717d7..6e4c089b7555 100755
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -217,7 +217,9 @@ class MyUriHelper:
 
             # path to the .py file + "$functionname, arguments, etc
             xStorageUri = self.m_uriRefFac.parse(scriptURI)
-            sStorageUri = xStorageUri.getName().replace( "|", "/" );
+            # getName will apply url-decoding to the name, so encode back
+            sStorageUri = xStorageUri.getName().replace("%", "%25")
+            sStorageUri = sStorageUri.replace( "|", "/" )
 
             # path to the .py file, relative to the base
             sFileUri = sStorageUri[0:sStorageUri.find("$")]
commit a825fa1071d7172776cd3a3196f89c5d439978c2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jul 26 13:25:31 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:21:23 2019 +0200

    decode url escape codes and check each path segment
    
    Change-Id: Ie8f7cef912e8dacbc2a0bca73534a7a242a53ca1
    Reviewed-on: https://gerrit.libreoffice.org/76378
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 7942929685fafb0f9c82feb8da7279e5103c87f0)
    Reviewed-on: https://gerrit.libreoffice.org/76453
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit a99e6d6ae7537e701267cf0f2e79c30194189bfa)

diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index a2db44260005..a07bc21e27fb 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -54,6 +54,8 @@
 #include <com/sun/star/script/provider/XScriptProvider.hpp>
 #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
 #include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/uri/UriReferenceFactory.hpp>
+#include <com/sun/star/uri/XVndSunStarScriptUrlReference.hpp>
 #include <com/sun/star/util/XModifiable.hpp>
 
 #include <toolkit/helper/vclunohelper.hxx>
@@ -1509,7 +1511,32 @@ namespace
 // don't allow LibreLogo to be used with our mouseover/etc dom-alike events
 bool SfxObjectShell::UnTrustedScript(const OUString& rScriptURL)
 {
-    return rScriptURL.startsWithIgnoreAsciiCase("vnd.sun.star.script:LibreLogo");
+    if (!rScriptURL.startsWith("vnd.sun.star.script:"))
+        return false;
+
+    // ensure URL Escape Codes are decoded
+    css::uno::Reference<css::uri::XUriReference> uri(
+        css::uri::UriReferenceFactory::create(comphelper::getProcessComponentContext())->parse(rScriptURL));
+    css::uno::Reference<css::uri::XVndSunStarScriptUrl> sfUri(uri, css::uno::UNO_QUERY);
+
+    if (!sfUri.is())
+        return false;
+
+    OUString sScript = sfUri->getName();
+
+    // check if any path portion matches LibreLogo and ban it if it does
+    sal_Int32 nIndex = 0;
+    do
+    {
+        OUString aToken = sScript.getToken(0, '/', nIndex);
+        if (aToken.startsWithIgnoreAsciiCase("LibreLogo"))
+        {
+            return true;
+        }
+    }
+    while (nIndex >= 0);
+
+    return false;
 }
 
 ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const OUString& _rScriptURL,
commit 8e99845b78c8c921f0230f0b2a8f2b1afc5f98e7
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 23 15:31:05 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:21:23 2019 +0200

    expand LibreLogo check to global events
    
    Reviewed-on: https://gerrit.libreoffice.org/76189
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 4a66c7eda6ccde26a42c4e31725248c59940255d)
    
    Change-Id: I7f436983ba0eb4b76b02d08ee52626e54b103d5f
    (cherry picked from commit e5702eefdfe6d44a92fdfb3c6a3ff47fec83ee49)
    Reviewed-on: https://gerrit.libreoffice.org/76452
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 29d5fcb1bd034f99cb9153c99d58ab70d69980c5)

diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 05aa6a7404a9..3c6658b44a03 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -402,6 +402,8 @@ public:
     */
     bool                        AdjustMacroMode( const OUString& rScriptType, bool _bSuppressUI = false );
 
+    static bool                 UnTrustedScript(const OUString& rScriptURL);
+
     SvKeyValueIterator*         GetHeaderAttributes();
     void                        ClearHeaderAttributesForSourceViewHack();
     void                        SetHeaderAttributesForSourceViewHack();
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 9e5116521038..a2db44260005 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1506,16 +1506,12 @@ namespace
     }
 }
 
-namespace {
-
 // don't allow LibreLogo to be used with our mouseover/etc dom-alike events
-bool UnTrustedScript(const OUString& rScriptURL)
+bool SfxObjectShell::UnTrustedScript(const OUString& rScriptURL)
 {
     return rScriptURL.startsWithIgnoreAsciiCase("vnd.sun.star.script:LibreLogo");
 }
 
-}
-
 ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const OUString& _rScriptURL,
     const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller )
 {
diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx
index 67c2743b5847..1ba96ae88e69 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -219,18 +219,24 @@ static void Execute( uno::Any& aEventData, const document::DocumentEvent& aTrigg
         else if (aType == "Service" ||
                   aType == "Script")
         {
-            if ( !aScript.isEmpty() )
+            bool bAllowed = false;
+            util::URL aURL;
+            if (!aScript.isEmpty())
             {
-                SfxViewFrame* pView = pDoc ?
-                    SfxViewFrame::GetFirst( pDoc ) :
-                    SfxViewFrame::Current();
-
                 uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
 
-                util::URL aURL;
                 aURL.Complete = aScript;
                 xTrans->parseStrict( aURL );
 
+                bAllowed = !SfxObjectShell::UnTrustedScript(aURL.Complete);
+            }
+
+            if (bAllowed)
+            {
+                SfxViewFrame* pView = pDoc ?
+                    SfxViewFrame::GetFirst( pDoc ) :
+                    SfxViewFrame::Current();
+
                 uno::Reference
                     < frame::XDispatchProvider > xProv;
 
commit e7800f7d887a1e070b167a9a18ad05923582c9ae
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jun 7 14:04:07 2019 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:21:23 2019 +0200

    explictly exclude LibreLogo from XScript usage
    
    Change-Id: I567647f0e2f8b82e4ef2995c673abe82f4564228
    Reviewed-on: https://gerrit.libreoffice.org/73659
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit cb0024e3668979dfdef44db5aa15ddfaf035e695)
    (cherry picked from commit 9b4d3561b4d8dd7e96695ffaabb805db1d4e25ab)

diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 4285fafe8f2a..9e5116521038 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1506,6 +1506,16 @@ namespace
     }
 }
 
+namespace {
+
+// don't allow LibreLogo to be used with our mouseover/etc dom-alike events
+bool UnTrustedScript(const OUString& rScriptURL)
+{
+    return rScriptURL.startsWithIgnoreAsciiCase("vnd.sun.star.script:LibreLogo");
+}
+
+}
+
 ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const OUString& _rScriptURL,
     const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller )
 {
@@ -1518,6 +1528,9 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon
     if ( bIsDocumentScript && !lcl_isScriptAccessAllowed_nothrow( _rxScriptContext ) )
         return ERRCODE_IO_ACCESSDENIED;
 
+    if ( UnTrustedScript(_rScriptURL) )
+        return ERRCODE_IO_ACCESSDENIED;
+
     bool bCaughtException = false;
     Any aException;
     try
commit 8cfbb7bf340d14d45dfa42b32c91f1f5bc259582
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Thu Jun 6 14:25:32 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:21:23 2019 +0200

    sanitize LibreLogo calls
    
    Reviewed-on: https://gerrit.libreoffice.org/73627
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 1b63fa32bbd4a5b89d2ee3a53b28de4250c8dad3)
    (cherry picked from commit a781c5e2733ce5c975721fc6d46ff72e8cda3956)
    
    Change-Id: Ie4d9858e5b4b3e55ab08416fb9338d2df34ee5e1

diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py
index d44ffa194a6d..dcbb37337454 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -67,6 +67,7 @@ __LineStyle_DOTTED__ = 2
 class __Doc__:
     def __init__(self, doc):
         self.doc = doc
+        self.secure = False
         try:
             self.drawpage = doc.DrawPage # Writer
         except:
@@ -381,10 +382,58 @@ class LogoProgram(threading.Thread):
         self.code = code
         threading.Thread.__init__(self)
 
+    def secure(self):
+        # 0 = secure
+        if _.secure:
+            return 0
+
+        # 1 = forms, fields or embedded objects are forbidden
+        if _.doc.DrawPage.Forms.getCount() > 0 or _.doc.getTextFields().createEnumeration().hasMoreElements() or _.doc.getEmbeddedObjects().getCount() > 0:
+            return 1
+
+        # 2 = hyperlinks with script events
+        nodes = _.doc.Text.createEnumeration()
+        while nodes.hasMoreElements():
+            node = nodes.nextElement()
+            if node.supportsService("com.sun.star.text.Paragraph"):
+                portions = node.createEnumeration()
+                while portions.hasMoreElements():
+                    portion = portions.nextElement()
+                    if portion.PropertySetInfo.hasPropertyByName("HyperLinkEvents"):
+                        events = portion.getPropertyValue("HyperLinkEvents")
+                        for event in events.getElementNames():
+                            attributes = events.getByName(event)
+                            for attribute in attributes:
+                                if attribute.Name == "EventType" and attribute.Value == "Script":
+                                    return 2
+
+        # 2 = images with script events
+        images = _.doc.DrawPage.createEnumeration()
+        while images.hasMoreElements():
+            image = images.nextElement()
+            try:
+                events = image.Events
+                for event in events.getElementNames():
+                    attributes = events.getByName(event)
+                    for attribute in attributes:
+                        if attribute.Name == "EventType" and attribute.Value == "Script":
+                            return 2
+            except:
+                pass
+
+        _.secure = True
+        return 0
+
     def run(self):
         global __thread__
         try:
-            exec(self.code)
+            # check document security
+            secid = self.secure()
+            if secid > 0:
+                parent = _.doc.CurrentController.Frame.ContainerWindow
+                MessageBox(parent, "Document objects with%s script events" % [" possible", ""][secid-1], "LibreLogo program can't start", "errorbox")
+            else:
+                exec(self.code)
             if _.origcursor:
                 __dispatcher__(".uno:Escape")
                 try:
commit 20a4782cc70684189d2153f774678b5ed88e6600
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Aug 28 11:20:35 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Aug 28 11:21:23 2019 +0200

    boost: fix build with GCC9, implicit shared_ptr->bool
    
    Change-Id: I1e4c7a63d299f93a18f815f8af302fbe297d38eb

diff --git a/external/boost/UnpackedTarball_boost.mk b/external/boost/UnpackedTarball_boost.mk
index 777a8c4417eb..35a8080c2b6c 100644
--- a/external/boost/UnpackedTarball_boost.mk
+++ b/external/boost/UnpackedTarball_boost.mk
@@ -47,6 +47,7 @@ boost_patches += boost.wshadow.patch
 boost_patches += boost.wdeprecated-register.patch.0
 boost_patches += boost.wuninitialized.patch
 boost_patches += boost.wdeprecated-auto_ptr.patch.0
+boost_patches += boost-shared_ptr-bool.patch.1
 
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,boost))
 
diff --git a/external/boost/boost-shared_ptr-bool.patch.1 b/external/boost/boost-shared_ptr-bool.patch.1
new file mode 100644
index 000000000000..556a8ed42c0d
--- /dev/null
+++ b/external/boost/boost-shared_ptr-bool.patch.1
@@ -0,0 +1,11 @@
+--- boost/boost/date_time/local_time/custom_time_zone.hpp.orig	2019-08-28 11:16:44.660857011 +0200
++++ boost/boost/date_time/local_time/custom_time_zone.hpp	2019-08-28 11:16:49.063758969 +0200
+@@ -64,7 +64,7 @@
+     //! True if zone uses daylight savings adjustments
+     virtual bool has_dst() const
+     {
+-      return (dst_calc_rules_); //if calc_rule is set the tz has dst
++      return (bool(dst_calc_rules_)); //if calc_rule is set the tz has dst
+     }
+     //! Local time that DST starts -- NADT if has_dst is false
+     virtual posix_time::ptime dst_local_start_time(gregorian::greg_year y) const
commit cdbb0f0290143464ed868fa7e48bf4d96a0e6b30
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Aug 27 18:55:12 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Aug 27 18:55:12 2019 +0200

    backport ooxmlsdrexport.cxx part of...
    
    commit b2371492dfd5c8003f89ed8acf3dbc690d6af8d0
    Author:     Stephan Bergmann <sbergman at redhat.com>
    AuthorDate: Mon Mar 3 18:27:00 2014 +0100
    Commit:     Stephan Bergmann <sbergman at redhat.com>
    CommitDate: Mon Mar 3 18:36:55 2014 +0100
    
        Use cstdlib std::abs instead of stdlib.h abs
    
        ...because the latter lacks the abs(long) overload in some popular environme
    nts,
        cf. <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60401> "stdlib.h does not
        provide abs(long) overload."
    
        Similarly, stdlib.h lacks the abs(float), abs(double), abs(long double)
        overloads compared to cmath there, whose use was apparently intended in
        sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx.  Rewrote that to use
        CPPUNIT_ASSERT_DOUBLES_EQUAL instead, which revealed that the comparisons ne
    ed
        rather large deltas of .1 resp. .2 (which the original code hid with an
        implicit conversion to integral type, thus using an effective delta of 1).
    
        Discovered with -Wabsolute-value ("absolute value function 'abs' given an
        argument of type 'long' but has parameter of type 'int' which may cause
        truncation of value") recently introduced on Clang trunk towards 3.5.
    
        Change-Id: I4c41575ffdccb2944498b662bd3a53fd510cb0c0
    
    Change-Id: I06ba8ebf89969bdc91d229a70ff62b644815ee8b

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b269a11f68da..3c73b1555f34 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1807,22 +1807,22 @@ DECLARE_OOXMLEXPORT_TEST(testFdo70838, "fdo70838.docx")
             if( aStyleCommandName.equals( "margin-left" ) )
             {
                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
-                CPPUNIT_ASSERT_EQUAL(0, abs(97.6 - fValue));
+                CPPUNIT_ASSERT_DOUBLES_EQUAL(97.6, fValue, 0.1);
             }
             else if( aStyleCommandName.equals( "margin-top" ) )
             {
                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
-                CPPUNIT_ASSERT_EQUAL(0, abs(165 - fValue));
+                CPPUNIT_ASSERT_DOUBLES_EQUAL(165.0, fValue, 0.2);
             }
             else if( aStyleCommandName.equals( "width" ) )
             {
                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
-                CPPUNIT_ASSERT_EQUAL(0, abs(283.4 - fValue));
+                CPPUNIT_ASSERT_DOUBLES_EQUAL(283.4, fValue, 0.1);
             }
             else if( aStyleCommandName.equals( "height" ) )
             {
                 float fValue = aStyleCommandValue.getToken( 0, 'p' ).toFloat();
-                CPPUNIT_ASSERT_EQUAL(0, abs(141.7 - fValue));
+                CPPUNIT_ASSERT_DOUBLES_EQUAL(141.7, fValue, 0.1);
             }
 
         } while( nextTokenPos != -1 );
commit eaa45f4b902dfbfe6711b99a824902ccaf3dcda6
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jul 11 15:16:48 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Aug 27 18:35:33 2019 +0200

    basebmp: #ifdef some dead code
    
    libreoffice-4-1-6+backports/include/basebmp/packedpixeliterator.hxx:607:35: error: expression cannot be used as a function
             const int remainder( x(d.x) % num_intraword_positions );
    
    This was removed in:
    commit 1b4dff2c371d31c99f34324c3f6f31888bdc34d7 "loplugin:unusedmethods"
    
    Change-Id: I3bfc28da8f977633f0b4d808237235a5316338c4

diff --git a/include/basebmp/packedpixeliterator.hxx b/include/basebmp/packedpixeliterator.hxx
index e419a352f1a3..2cd487d4ae0a 100644
--- a/include/basebmp/packedpixeliterator.hxx
+++ b/include/basebmp/packedpixeliterator.hxx
@@ -602,6 +602,7 @@ public:
                 >> get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder));
     }
 
+#if 0
     value_type get(difference_type const & d) const
     {
         const int remainder( x(d.x) % num_intraword_positions );
@@ -610,6 +611,7 @@ public:
                                           get_mask<value_type, bits_per_pixel, MsbFirst>(remainder))
                 >> get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder));
     }
+#endif
 
     void set( value_type v ) const
     {
commit 8cbd5babd425669f8f487bf512376c7dfba3f0b5
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri May 16 21:49:23 2014 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Aug 27 18:35:24 2019 +0200

    vcl: GTK: fix libstdc++ "irreflexive" assert
    
    /usr/include/c++/6.1.1/bits/stl_algo.h:4737:
    Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).
    
    GdkRectangleCoincident is clearly not a less-than operator as required
    for std::sort.
    
    (cherry picked from commit e2b267b1906817cc45f0e4896bed58cff5b6b0f9)
    Reviewed-on: https://gerrit.libreoffice.org/26762
    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>
    (cherry picked from commit 8851333f8aafe84ca9479faf24d9164035aff520)
    
    squashed dependency:
    fdo#78799 - ignore overlayed monitors with co-incident origin.
    This happens with certain fglrx drivers etc. where 'cloned' is not
    set but instead both monitors are placed over the top of each other
    (by XFCE) -> work around that.
    (cherry picked from commit 5eeea7c91d87ee8f0b8bc8c0144c04fb84310bbf)
    
    Change-Id: If2e65d420dc8cdf0707081361a40d4eaea28424e

diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx
index 0a72054aeb9d..7284aa8e67d5 100644
--- a/vcl/unx/gtk/app/gtksys.cxx
+++ b/vcl/unx/gtk/app/gtksys.cxx
@@ -55,15 +55,25 @@ GtkSalSystem::GetDisplayXScreenCount()
 namespace
 {
 
-struct GdkRectangleEqual
+struct GdkRectangleCoincidentLess
 {
+    // fdo#78799 - detect and elide overlaying monitors of different sizes
+    bool operator()(GdkRectangle const& rLeft, GdkRectangle const& rRight)
+    {
+        return
+            rLeft.x < rRight.x
+            || rLeft.y < rRight.y
+            ;
+    }
+};
+struct GdkRectangleCoincident
+{
+    // fdo#78799 - detect and elide overlaying monitors of different sizes
     bool operator()(GdkRectangle const& rLeft, GdkRectangle const& rRight)
     {
         return
             rLeft.x == rRight.x
             && rLeft.y == rRight.y
-            && rLeft.width == rRight.width
-            && rLeft.height == rRight.height
             ;
     }
 };
@@ -95,10 +105,11 @@ GtkSalSystem::countScreenMonitors()
                 gdk_screen_get_monitor_geometry(pScreen, j, &aGeometry);
                 aGeometries.push_back(aGeometry);
             }
-            GdkRectangleEqual aCmp;
-            std::sort(aGeometries.begin(), aGeometries.end(), aCmp);
+            std::sort(aGeometries.begin(), aGeometries.end(),
+                    GdkRectangleCoincidentLess());
             const std::vector<GdkRectangle>::iterator aUniqueEnd(
-                    std::unique(aGeometries.begin(), aGeometries.end(), aCmp));
+                    std::unique(aGeometries.begin(), aGeometries.end(),
+                    GdkRectangleCoincident()));
             nMonitors = std::distance(aGeometries.begin(), aUniqueEnd);
         }
         maScreenMonitors.push_back(std::make_pair(pScreen, nMonitors));
commit 01fe07e83e2bbf2c9c5311589b33f0455463d981
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Jan 19 10:43:21 2016 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Aug 27 18:34:48 2019 +0200

    -Werror=shift-negative-value (GCC 6)
    
    Change-Id: Ifc7b1d6675a8e8fb41dd47cc1282059c3790736f
    (cherry picked from commit 352f9fdff619b5a0a1414c29cfc47068165a599c)

diff --git a/include/basebmp/packedpixeliterator.hxx b/include/basebmp/packedpixeliterator.hxx
index 55cc1742d4c5..e419a352f1a3 100644
--- a/include/basebmp/packedpixeliterator.hxx
+++ b/include/basebmp/packedpixeliterator.hxx
@@ -79,7 +79,7 @@ public:
         num_intraword_positions=sizeof(value_type)*8/bits_per_pixel,
         /** Bit mask for one pixel (least significant bits)
          */
-        bit_mask=~(~0 << bits_per_pixel)
+        bit_mask=~(~0u << bits_per_pixel)
     };
 
 private:
@@ -249,7 +249,7 @@ public:
         num_intraword_positions=sizeof(value_type)*8/bits_per_pixel,
         /** Bit mask for one pixel (least significant bits)
          */
-        bit_mask=~(~0 << bits_per_pixel)
+        bit_mask=~(~0u << bits_per_pixel)
     };
 
 private:
@@ -502,7 +502,7 @@ public:
         num_intraword_positions=sizeof(value_type)*8/bits_per_pixel,
         /** Bit mask for one pixel (least significant bits)
          */
-        bit_mask=~(~0 << bits_per_pixel)
+        bit_mask=~(~0u << bits_per_pixel)
     };
 
     // TODO(F2): direction of iteration (ImageIterator can be made to
commit 1e584bd359cf1fb5594f77fc7b4521aa5657a8ed
Author:     Michael Stahl <mstahl at redhat.com>
AuthorDate: Thu Feb 18 14:06:35 2016 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Aug 27 18:28:50 2019 +0200

    fdo#94009: harfbuzz: don't export symbols from VCL
    
    Should fix crashes due to symbol clashes in ELF global namespace
    where system's libharfbuzz.so.0 is loaded as well.
    
    (cherry picked from commit 549130ab5d9616f7eb5504db31546b386737ccb2)
    
    Change-Id: I35ffcbe4ac4de5a25cd8bf0cb9a8f0c11f4554c5

diff --git a/external/harfbuzz/ExternalProject_harfbuzz.mk b/external/harfbuzz/ExternalProject_harfbuzz.mk
index f49553d4b6c8..1fbad2edfa35 100644
--- a/external/harfbuzz/ExternalProject_harfbuzz.mk
+++ b/external/harfbuzz/ExternalProject_harfbuzz.mk
@@ -30,6 +30,7 @@ $(call gb_ExternalProject_get_state_target,harfbuzz,build) :
 			--with-cairo=no \
 			--with-glib=no \
 			$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
+			$(if $(filter LINUX,$(OS)),CXXFLAGS="$(CXXFLAGS) -fvisibility=hidden") \
 		&& (cd $(EXTERNAL_WORKDIR)/src && $(MAKE)) \
 	)
 
commit 69ccd11d223737432534d2f1022ca4f9beeb7ceb
Author:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Thu Jul 5 01:33:23 2018 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Aug 27 18:27:43 2019 +0200

    gcc7: disable -Wdeprecated for dynamic excpt specs
    
    gcc started to warn about c++11-deprecated dynamic exception
    specifications thusly:
    
    warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    
    so disable this on the branch instead of a massive backport.
    
    See https://en.cppreference.com/w/cpp/language/except_spec for a
    discussion; this is still perfectly correct c++ code.
    
    Change-Id: Iffbb82e4da24fb96fab57f233b8ebe41fbc850fa
    Reviewed-on: https://gerrit.libreoffice.org/56981
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 52b85ab2adf74e82cb598d9273b1639b11c28270)

diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 1276e57502d6..048b75aa0da6 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -42,6 +42,7 @@ gb_CXXFLAGS := \
 	$(gb_CXXFLAGS_COMMON) \
 	-fPIC \
 	-Wshadow \
+	-Wno-deprecated \
 	-Woverloaded-virtual \
 
 ifeq ($(COM_GCC_IS_CLANG),)
commit a30e3ada2dc0349280ff85d192c8fd17ac61ab05
Author:     Michael Stahl <mstahl at redhat.com>
AuthorDate: Thu Mar 12 15:40:05 2015 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Aug 27 17:13:14 2019 +0200

    formula: PVS-Studio V610 Undefined behavior shift negative signed int
    
    Change-Id: If6c054abfab6ba421a6924a65dac76782e6eaa0b
    (cherry picked from commit f1b5381ed70a21a6f460bcd6a8bedad10b9a5a02)

diff --git a/include/formula/grammar.hxx b/include/formula/grammar.hxx
index 1971c4fb4d97..b622f576eaba 100644
--- a/include/formula/grammar.hxx
+++ b/include/formula/grammar.hxx
@@ -54,7 +54,7 @@ public:
     // Room for 256 reference conventions.
     static const int kEnglishBit       = (1 << (kConventionShift + 8));
     // Mask off all non-language bits.
-    static const int kFlagMask         = ~((~int(0)) << kConventionShift);
+    static const int kFlagMask         = ~((~unsigned(0)) << kConventionShift);
 
     /** Values encoding the formula language plus address reference convention
         plus English parsing/formatting
commit 227d25cfb3d7a4c1790302d1c5b334ea27975f88
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Jul 8 09:49:50 2014 +0300
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Aug 27 16:12:52 2019 +0200

    Fix some round() confusion
    
    Why insist on using the same name as a standard function? Causes
    confusion with VS2013 at least, "ambiguous call to overloaded
    function."
    
    Sure, this might be caused by a bug in the compiler (or its
    headers). Or maybe vagueness in the language definition? Who cares, I
    still claim that intentionally writing an own function called round()
    is asking for problems. So rename it to round_to_long().
    
    (And then the return value of calls to this function, which is of type
    'long', is assigned in a couple of places to variables of type 'int',
    fun... Intentional, knowing there will be no overflow, or a bug
    waiting to happen?)
    
    (cherry picked from commit ba27300d419786ca6fa8a7df950d01f472de3314)
    
    Change-Id: If15d44f10f9f05de1c7c79492baf158eee770b8b

diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 499458eb307f..4bbea3c19c14 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -40,6 +40,8 @@
 #include <deque>
 
 // Platform
+#include <config_global.h>
+
 #include <svsys.h>
 
 #include <salgdi.hxx>
@@ -87,7 +89,7 @@ static FILE * grLog()
 
 namespace
 {
-    inline long round(const float n) {
+    inline long round_to_long(const float n) {
         return long(n + (n < 0 ? -0.5 : 0.5));
     }
 
@@ -238,8 +240,8 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fSc
         if (nextBoundary > fMaxX && (nextChar < mnMinCharPos || nextChar >= mnEndCharPos || !isWhite(pStr[nextChar]) || fMaxX <= 0.0f))
             fMaxX = nextBoundary;
     }
-    long nXOffset = round(fMinX * fScaling);
-    long nXEnd = round(fMaxX * fScaling);
+    long nXOffset = round_to_long(fMinX * fScaling);
+    long nXEnd = round_to_long(fMaxX * fScaling);
     int nCharRequested = minimum<int>(lastCharPos, mnEndCharPos) - mnMinCharPos;
     int firstCharOffset = maximum<int>(mnSegCharOffset, mnMinCharPos) - mnMinCharPos;
     // fill up non-base char dx with cluster widths from previous base glyph
@@ -312,8 +314,8 @@ GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs &rArgs,
 
     long glyphId = gr_slot_gid(gi);
     long deltaOffset = 0;
-    int scaledGlyphPos = round(gr_slot_origin_X(gi) * scaling) + mnWidth + rDXOffset;
-    int glyphWidth = round((nextGlyphOrigin - gOrigin) * scaling);
+    int scaledGlyphPos = round_to_long(gr_slot_origin_X(gi) * scaling) + mnWidth + rDXOffset;
+    int glyphWidth = round_to_long((nextGlyphOrigin - gOrigin) * scaling);
     if (!bIsBase)
     {
         mvChar2BaseGlyph[firstChar - mnMinCharPos] = baseGlyph;
@@ -358,11 +360,11 @@ GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs &rArgs,
     nGlyphFlags |= (bRtl)? GlyphItem::IS_RTL_GLYPH : 0;
     GlyphItem aGlyphItem(mvGlyphs.size(),
         glyphId,
-        Point(scaledGlyphPos, round((-gr_slot_origin_Y(gi) * scaling))),
+        Point(scaledGlyphPos, round_to_long((-gr_slot_origin_Y(gi) * scaling))),
         nGlyphFlags,
         glyphWidth);
     if (glyphId != static_cast<long>(GF_DROPPED))
-        aGlyphItem.mnOrigWidth = round(gr_slot_advance_X(gi, mpFace, mpFont) * scaling);
+        aGlyphItem.mnOrigWidth = round_to_long(gr_slot_advance_X(gi, mpFace, mpFont) * scaling);
     mvGlyphs.push_back(aGlyphItem);
 
     // update the offset if this glyph was dropped


More information about the Libreoffice-commits mailing list