[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 4 commits - librelogo/source sfx2/source sw/inc sw/source
Andras Timar (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 19 11:36:53 UTC 2019
librelogo/source/LibreLogo/LibreLogo.py | 51 ++++++++++++++++++++-
sfx2/source/doc/objmisc.cxx | 13 +++++
sw/inc/unosett.hxx | 2
sw/source/core/text/porfld.cxx | 4 -
sw/source/core/text/porfld.hxx | 1
sw/source/core/text/txtfld.cxx | 12 ++++
sw/source/core/unocore/unosett.cxx | 15 ++++--
sw/source/uibase/config/StoredChapterNumbering.cxx | 2
sw/source/uibase/dbui/dbmgr.cxx | 2
9 files changed, 92 insertions(+), 10 deletions(-)
New commits:
commit 4817870978162650d06c2489446868898c1a2bb4
Author: Andras Timar <andras.timar at collabora.com>
AuthorDate: Wed Jun 19 07:34:27 2019 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Jun 19 13:36:14 2019 +0200
build fix
Change-Id: I934967b97c327349ac60c828f39192ec19fe4837
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 1849f9fa5e00..ab494aae0510 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1379,7 +1379,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
INetURLObject aEntry( sPrefix );
sLeading = aEntry.GetBase();
aEntry.removeSegment();
- sPrefix = aEntry.GetMainURL( INetURLObject::DecodeMechanism::NONE );
+ sPrefix = aEntry.GetMainURL( INetURLObject::DecodeMechanism::NO_DECODE );
}
OUString sExt(comphelper::string::stripStart(pStoreToFilter->GetDefaultExtension(), '*'));
commit d35df1b6459552fbc9788915037cbc65338a7ace
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jun 7 09:28:12 2019 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Jun 19 12:09:32 2019 +0200
More uses of referer URL with SvxBrushItem
Reviewed-on: https://gerrit.libreoffice.org/73643
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
(cherry picked from commit b518882de8213ef71a8003f95fbdf7689069c06d)
Conflicts:
sw/source/core/text/porfld.cxx
sw/source/core/unocore/unosett.cxx
Reviewed-on: https://gerrit.libreoffice.org/73860
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
(cherry picked from commit 87c418a98650ab6e4a62a0b4b72e02fee358dced)
Change-Id: I04b524784df4ef453d8b1feec13b62f183a17e23
diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx
index 73ce65c600e8..b01606a45623 100644
--- a/sw/inc/unosett.hxx
+++ b/sw/inc/unosett.hxx
@@ -208,7 +208,7 @@ public:
static css::uno::Sequence<css::beans::PropertyValue> GetPropertiesForNumFormat(
const SwNumFormat& rFormat, OUString const& rCharFormatName,
- OUString const* pHeadingStyleName);
+ OUString const* pHeadingStyleName, OUString const & referer);
static void SetPropertiesToNumFormat(
SwNumFormat & aFormat,
OUString & rCharStyleName,
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 4f24e63b33f0..ba60112b41d2 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -756,7 +756,7 @@ SwBulletPortion::SwBulletPortion( const sal_Unicode cBullet,
SwGrfNumPortion::SwGrfNumPortion(
SwFrame*,
const OUString& rGraphicFollowedBy,
- const SvxBrushItem* pGrfBrush,
+ const SvxBrushItem* pGrfBrush, OUString const & referer,
const SwFormatVertOrient* pGrfOrient, const Size& rGrfSize,
const bool bLft, const bool bCntr, const sal_uInt16 nMinDst,
const bool bLabelAlignmentPosAndSpaceModeActive ) :
@@ -770,7 +770,7 @@ SwGrfNumPortion::SwGrfNumPortion(
if( pGrfBrush )
{
*pBrush = *pGrfBrush;
- const Graphic* pGraph = pGrfBrush->GetGraphic();
+ const Graphic* pGraph = pGrfBrush->GetGraphic(referer);
if( pGraph )
SetAnimated( pGraph->IsAnimated() );
else
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 740c2d93769a..d648a0faf720 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -170,6 +170,7 @@ public:
SwGrfNumPortion( SwFrame *pFrame,
const OUString& rGraphicFollowedBy,
const SvxBrushItem* pGrfBrush,
+ OUString const & referer,
const SwFormatVertOrient* pGrfOrient,
const Size& rGrfSize,
const bool bLeft,
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 239e2a3d8081..b6f2c5eb14b8 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -52,6 +52,7 @@
#include "flddat.hxx"
#include "fmtautofmt.hxx"
#include <IDocumentSettingAccess.hxx>
+#include <sfx2/docfile.hxx>
#include <svl/itemiter.hxx>
static bool lcl_IsInBody( SwFrame *pFrame )
@@ -478,9 +479,18 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con
if( SVX_NUM_BITMAP == rNumFormat.GetNumberingType() )
{
+ OUString referer;
+ if (auto const sh1 = rInf.GetVsh()) {
+ if (auto const doc = sh1->GetDoc()) {
+ auto const sh2 = doc->GetPersist();
+ if (sh2 != nullptr && sh2->HasName()) {
+ referer = sh2->GetMedium()->GetName();
+ }
+ }
+ }
pRet = new SwGrfNumPortion( const_cast<SwTextFrame*>(GetTextFrame()),
pTextNd->GetLabelFollowedBy(),
- rNumFormat.GetBrush(),
+ rNumFormat.GetBrush(), referer,
rNumFormat.GetGraphicOrientation(),
rNumFormat.GetGraphicSize(),
bLeft, bCenter, nMinDist,
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 716ab9da1d10..7ada9bb06081 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -55,6 +55,7 @@
#include <vcl/font.hxx>
#include <editeng/flstitem.hxx>
#include <vcl/metric.hxx>
+#include <sfx2/docfile.hxx>
#include <svtools/ctrltool.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
@@ -1342,13 +1343,21 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
SwStyleNameMapper::FillProgName(sValue, aUString, SwGetPoolIdFromName::TxtColl, true);
}
- return GetPropertiesForNumFormat(rFormat, CharStyleName, (pDocShell) ? & aUString : nullptr);
+ OUString referer;
+ if (pDoc != nullptr) {
+ auto const sh = pDoc->GetPersist();
+ if (sh != nullptr && sh->HasName()) {
+ referer = sh->GetMedium()->GetName();
+ }
+ }
+ return GetPropertiesForNumFormat(
+ rFormat, CharStyleName, (pDocShell) ? & aUString : nullptr, referer);
}
uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat(
const SwNumFormat& rFormat, OUString const& rCharFormatName,
- OUString const*const pHeadingStyleName)
+ OUString const*const pHeadingStyleName, OUString const & referer)
{
bool bChapterNum = pHeadingStyleName != nullptr;
@@ -1480,7 +1489,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat
//graphicbitmap
const Graphic* pGraphic = nullptr;
if(pBrush )
- pGraphic = pBrush->GetGraphic();
+ pGraphic = pBrush->GetGraphic(referer);
if(pGraphic)
{
uno::Reference<awt::XBitmap> xBmp = VCLUnoHelper::CreateBitmap( pGraphic->GetBitmapEx() );
diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx
index 2464878b136b..a56aeebcc92e 100644
--- a/sw/source/uibase/config/StoredChapterNumbering.cxx
+++ b/sw/source/uibase/config/StoredChapterNumbering.cxx
@@ -135,7 +135,7 @@ public:
OUString dummy; // pass in empty HeadingStyleName - can't import anyway
uno::Sequence<beans::PropertyValue> const ret(
SwXNumberingRules::GetPropertiesForNumFormat(
- *pNumFormat, *pCharStyleName, &dummy));
+ *pNumFormat, *pCharStyleName, &dummy, ""));
return uno::makeAny(ret);
}
commit 5cd824a26527399c197168fc9095855b8ebc5d19
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jun 7 14:04:07 2019 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Jun 19 12:09:22 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>
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 59be71d84d2e..881d0a3bcad6 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1427,6 +1427,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 css::uno::Any* pCaller )
{
@@ -1439,6 +1449,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 f5a3dd0165a39bb559c292ce8d524d39968c3c08
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Thu Jun 6 14:25:32 2019 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Jun 19 12:09:11 2019 +0200
sanitize LibreLogo calls
Change-Id: Ie4d9858e5b4b3e55ab08416fb9338d2df34ee5e1
Reviewed-on: https://gerrit.libreoffice.org/73627
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py
index f51202ce1a31..e0c596592df4 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -76,6 +76,7 @@ __LineStyle_DOTTED__ = 2
class __Doc__:
def __init__(self, doc):
self.doc = doc
+ self.secure = False
try:
self.drawpage = doc.DrawPage # Writer
except:
@@ -409,10 +410,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[0] and _.origcursor[1]:
__dispatcher__(".uno:Escape")
try:
More information about the Libreoffice-commits
mailing list