kbrown / rpms / libreoffice

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