uno::Reference<media::XPlayer> MediaWindowImpl::createPlayer(const OUString& rURL, const OUString& rReferer, const OUString* pMimeType)
{
- uno::Reference<media::XPlayer> xPlayer;
-
if( rURL.isEmpty() )
- return xPlayer;
+ return nullptr;
if (SvtSecurityOptions::isUntrustedReferer(rReferer))
- {
- return xPlayer;
- }
+ return nullptr;
+
+ if (INetURLObject(rURL).IsExoticProtocol())
+ return nullptr;
+
+ uno::Reference<media::XPlayer> xPlayer;
if (!pMimeType || *pMimeType == AVMEDIA_MIMETYPE_COMMON)
{
#include <svl/memberid.h>
#include <rtl/math.hxx>
#include <rtl/ustring.hxx>
+#include <sal/log.hxx>
#include <tools/mapunit.hxx>
#include <tools/UnitConversion.hxx>
#include <vcl/graphicfilter.hxx>
return nullptr;
}
+ INetURLObject aGraphicURL( maStrLink );
+ if (aGraphicURL.IsExoticProtocol())
+ {
+ SAL_WARN("editeng", "Ignore exotic protocol: " << maStrLink);
+ return nullptr;
+ }
+
// tdf#94088 prepare graphic and state
Graphic aGraphic;
bool bGraphicLoaded = false;
// a 'data:' scheme url and try to load that (embedded graphics)
if(!bGraphicLoaded)
{
- INetURLObject aGraphicURL( maStrLink );
-
if( INetProtocol::Data == aGraphicURL.GetProtocol() )
{
std::unique_ptr<SvMemoryStream> const xMemStream(aGraphicURL.getData());
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/propertyvalue.hxx>
#include <unotools/mediadescriptor.hxx>
+#include <tools/urlobj.hxx>
#include <tools/diagnose_ex.h>
#include <sal/log.hxx>
uno::Sequence< beans::PropertyValue > aArgs( m_aDocMediaDescriptor.getLength() + nLen );
auto pArgs = aArgs.getArray();
- pArgs[0].Name = "URL";
- if(m_aLinkTempFile.is())
- pArgs[0].Value <<= m_aLinkTempFile->getUri();
+ OUString sURL;
+ if (m_aLinkTempFile.is())
+ sURL = m_aLinkTempFile->getUri();
else
- pArgs[0].Value <<= m_aLinkURL;
+ sURL = m_aLinkURL;
+ if (INetURLObject(sURL).IsExoticProtocol())
+ {
+ SAL_WARN("embeddedobj.common", "Ignore exotic protocol: " << pArgs[0].Value);
+ return nullptr;
+ }
+
+ pArgs[0].Name = "URL";
+ pArgs[0].Value <<= sURL;
pArgs[1].Name = "FilterName";
pArgs[1].Value <<= m_aLinkFilterName;
bool OImageControlModel::impl_updateStreamForURL_lck( const OUString& _rURL, ValueChangeInstigator _eInstigator )
{
+ if (INetURLObject(_rURL).IsExoticProtocol()) {
+ return false;
+ }
+
// create a stream for the image specified by the URL
std::unique_ptr< SvStream > pImageStream;
Reference< XInputStream > xImageStream;
// the SfxMedium is not allowed to be created with an invalid URL, so we have to check this first
INetURLObject aUrl(rURL);
- if (INetProtocol::NotValid == aUrl.GetProtocol())
+ if (INetProtocol::NotValid == aUrl.GetProtocol() || aUrl.IsExoticProtocol())
// we treat an invalid URL like we would treat no URL
return;
sReferer = sh->GetMedium()->GetName();
OUString sURL = rValue.get<OUString>();
- if (!SvtSecurityOptions::isUntrustedReferer(sReferer))
+ if (!SvtSecurityOptions::isUntrustedReferer(sReferer) &&
+ !INetURLObject(sURL).IsExoticProtocol())
+ {
rGraphic = vcl::graphic::loadFromURL(sURL, pParentWin);
+ }
if (rGraphic.IsNone())
rGraphic.SetDefaultType();
rGraphic.setOriginURL(sURL);
bool bNeedWidth = (!bPercentWidth && !nWidth) || bRelWidthScale;
bool bRelHeightScale = bPercentHeight && nHeight == SwFormatFrameSize::SYNCED;
bool bNeedHeight = (!bPercentHeight && !nHeight) || bRelHeightScale;
- if ((bNeedWidth || bNeedHeight) && !m_bFuzzing && allowAccessLink(*m_xDoc))
+ if ((bNeedWidth || bNeedHeight) && !m_bFuzzing && allowAccessLink(*m_xDoc) && !aGraphicURL.IsExoticProtocol())
{
GraphicDescriptor aDescriptor(aGraphicURL);
if (aDescriptor.Detect(/*bExtendedInfo=*/true))
#include <controls/formattedcontrol.hxx>
#include <toolkit/controls/unocontrols.hxx>
#include <toolkit/helper/property.hxx>
+#include <tools/urlobj.hxx>
#include <toolkit/helper/macros.hxx>
// for introspection
ImageHelper::getGraphicFromURL_nothrow( const OUString& _rURL )
{
uno::Reference< graphic::XGraphic > xGraphic;
- if ( _rURL.isEmpty() )
+ if (_rURL.isEmpty() || INetURLObject(_rURL).IsExoticProtocol())
return xGraphic;
try
return m_eScheme == INetProtocol::Slot ||
m_eScheme == INetProtocol::Macro ||
m_eScheme == INetProtocol::Uno ||
+ m_eScheme == INetProtocol::VndSunStarExpand ||
isSchemeEqualTo(u"vnd.sun.star.script") ||
isSchemeEqualTo(u"service");
}
/*-----------------------------------------------*/
bool MediaDescriptor::impl_openStreamWithURL( const OUString& sURL, bool bLockFile )
{
+ if (INetURLObject(sURL).IsExoticProtocol())
+ return false;
+
OUString referer(getUnpackedValueOrDefault(PROP_REFERRER, OUString()));
if (SvtSecurityOptions::isUntrustedReferer(referer)) {
return false;
ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& rPath,
sal_uInt16 nFormat, sal_uInt16 * pDeterminedFormat, GraphicFilterImportFlags nImportFlags )
{
- ErrCode nRetValue = ERRCODE_GRFILTER_FORMATERROR;
SAL_WARN_IF( rPath.GetProtocol() == INetProtocol::NotValid, "vcl.filter", "GraphicFilter::ImportGraphic() : ProtType == INetProtocol::NotValid" );
OUString aMainUrl( rPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
+ if (rPath.IsExoticProtocol())
+ {
+ SAL_WARN("vcl.filter", "GraphicFilter::ImportGraphic(), ignore exotic protocol: " << aMainUrl);
+ return ERRCODE_GRFILTER_FORMATERROR;
+ }
+
+ ErrCode nRetValue = ERRCODE_GRFILTER_FORMATERROR;
std::unique_ptr<SvStream> xStream(::utl::UcbStreamHelper::CreateStream( aMainUrl, StreamMode::READ | StreamMode::SHARE_DENYNONE ));
if (xStream)
{