summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-07-17 09:58:56 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-06-08 22:25:21 +0200
commitba45a24b54aebfab6429d2f19dd920272cacaa9f (patch)
tree916b758780071c3e1e2472bfbf139eba9fb3a605
parent195c70008f6fc9c9b4ac0568b04e3eaf3a034181 (diff)
put load of html images (to measure dimensions) under referer control
Change-Id: I1de4a5214ef48394dcafa97e4ea12bb460f2fba2 Reviewed-on: https://gerrit.libreoffice.org/57566 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sw/source/filter/html/htmlgrin.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 30a6fb8dc082..8884e5438d1b 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -40,6 +40,7 @@
#include <svtools/htmltokn.h>
#include <svtools/htmlkywd.hxx>
#include <unotools/eventcfg.hxx>
+#include <unotools/securityoptions.hxx>
#include <fmtornt.hxx>
#include <fmturl.hxx>
@@ -298,6 +299,20 @@ void SwHTMLParser::GetDefaultScriptType( ScriptType& rType,
rTypeStr = GetScriptTypeString( pHeaderAttrs );
}
+namespace
+{
+ bool allowAccessLink(SwDoc& rDoc)
+ {
+ OUString sReferer;
+ SfxObjectShell * sh = rDoc.GetPersist();
+ if (sh != nullptr && sh->HasName())
+ {
+ sReferer = sh->GetMedium()->GetName();
+ }
+ return !SvtSecurityOptions().isUntrustedReferer(sReferer);
+ }
+}
+
/* */
void SwHTMLParser::InsertImage()
@@ -595,7 +610,7 @@ IMAGE_SETEVENT:
bool bSetScaleImageMap = false;
sal_uInt8 nPrcWidth = 0, nPrcHeight = 0;
- if (!nWidth || !nHeight)
+ if ((!nWidth || !nHeight) && allowAccessLink(*m_pDoc))
{
GraphicDescriptor aDescriptor(aGraphicURL);
if (aDescriptor.Detect(/*bExtendedInfo=*/true))
@@ -603,7 +618,7 @@ IMAGE_SETEVENT:
// Try to use size info from the image header before defaulting to
// HTML_DFLT_IMG_WIDTH/HEIGHT.
aTwipSz = Application::GetDefaultDevice()->PixelToLogic(aDescriptor.GetSizePixel(),
- MapMode(MapUnit::MapTwip));
+ MapMode(MAP_TWIP));
nWidth = aTwipSz.getWidth();
nHeight = aTwipSz.getHeight();
}