64af5b
From 3dd024a28a98a9d4b4efc3c7ec6acaa94d2b25fd Mon Sep 17 00:00:00 2001
64af5b
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
64af5b
Date: Fri, 7 Jun 2019 14:04:07 +0100
64af5b
Subject: [PATCH] explictly exclude LibreLogo from XScript usage
64af5b
64af5b
Change-Id: I567647f0e2f8b82e4ef2995c673abe82f4564228
64af5b
Reviewed-on: https://gerrit.libreoffice.org/73708
64af5b
Tested-by: Jenkins
64af5b
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
64af5b
---
64af5b
 sfx2/source/doc/objmisc.cxx | 13 +++++++++++++
64af5b
 1 file changed, 13 insertions(+)
64af5b
64af5b
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
64af5b
index e245800f2fec..beea5170e44d 100644
64af5b
--- a/sfx2/source/doc/objmisc.cxx
64af5b
+++ b/sfx2/source/doc/objmisc.cxx
64af5b
@@ -1340,6 +1340,16 @@ namespace
64af5b
     }
64af5b
 }
64af5b
 
64af5b
+namespace {
64af5b
+
64af5b
+// don't allow LibreLogo to be used with our mouseover/etc dom-alike events
64af5b
+bool UnTrustedScript(const OUString& rScriptURL)
64af5b
+{
64af5b
+    return rScriptURL.startsWithIgnoreAsciiCase("vnd.sun.star.script:LibreLogo");
64af5b
+}
64af5b
+
64af5b
+}
64af5b
+
64af5b
 ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const OUString& _rScriptURL,
64af5b
     const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, const css::uno::Any* pCaller )
64af5b
 {
64af5b
@@ -1352,6 +1362,9 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon
64af5b
     if ( bIsDocumentScript && !lcl_isScriptAccessAllowed_nothrow( _rxScriptContext ) )
64af5b
         return ERRCODE_IO_ACCESSDENIED;
64af5b
 
64af5b
+    if ( UnTrustedScript(_rScriptURL) )
64af5b
+        return ERRCODE_IO_ACCESSDENIED;
64af5b
+
64af5b
     bool bCaughtException = false;
64af5b
     Any aException;
64af5b
     try
64af5b
-- 
64af5b
2.21.0
64af5b