add some protocols that don't make sense as floating frame targets
authorCaolán McNamara <caolan.mcnamara@collabora.com>
Fri, 3 Nov 2023 17:14:26 +0000 (17:14 +0000)
committerRene Engelhard <rene@debian.org>
Mon, 1 Apr 2024 09:05:27 +0000 (11:05 +0200)
Change-Id: Id900a5eef248731d1184c1df501a2cf7a2de7eb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158910
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 11ebdfef16501c6d35c3e3d0d62507f706557c71)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158900
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit bab433911bdecb344f7ea94dbd00690241a08c54)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159582

Gbp-Pq: Name floating-frame-targets-unneeded-protocols.diff

include/tools/urlobj.hxx
sfx2/source/doc/iframe.cxx
tools/source/fsys/urlobj.cxx

index 9d6820ddf2415be5f8a20a21873f4185bf6f9169..dfd658722826424271563289b2c8f377b62f6cb7 100644 (file)
@@ -915,6 +915,11 @@ public:
 
     void changeScheme(INetProtocol eTargetScheme);
 
+    // INetProtocol::Macro, INetProtocol::Uno, INetProtocol::Slot,
+    // vnd.sun.star.script, etc. All the types of URLs which shouldn't
+    // be accepted from an outside controlled source
+    bool IsExoticProtocol() const;
+
 private:
     // General Structure:
 
index 52962c4be75decd0ce8b95c7eac43ff2fdd16c1b..0c2f58044b62cb0ae99b06ad65231d59956b73b0 100644 (file)
@@ -168,8 +168,11 @@ sal_Bool SAL_CALL IFrameObject::load(
         xTrans->parseStrict( aTargetURL );
 
         INetURLObject aURLObject(aTargetURL.Complete);
-        if (aURLObject.GetProtocol() == INetProtocol::Macro || aURLObject.isSchemeEqualTo(u"vnd.sun.star.script"))
+        if (aURLObject.IsExoticProtocol())
+        {
+            SAL_WARN("sfx", "IFrameObject::load ignoring: " << aTargetURL.Complete);
             return false;
+        }
 
         uno::Reference<frame::XFramesSupplier> xParentFrame = xFrame->getCreator();
         SfxObjectShell* pDoc = SfxMacroLoader::GetObjectShell(xParentFrame);
index 00e3207b2d3bd232e3414aa1294a4ce0bcce150f..4a7411623dee96114b903193c981a08e38ceed89 100644 (file)
@@ -4827,4 +4827,12 @@ OUString INetURLObject::CutExtension()
         ? aTheExtension : OUString();
 }
 
+bool INetURLObject::IsExoticProtocol() const
+{
+    return m_eScheme == INetProtocol::Slot ||
+           m_eScheme == INetProtocol::Macro ||
+           m_eScheme == INetProtocol::Uno ||
+           isSchemeEqualTo(u"vnd.sun.star.script");
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */