tdf#100783 Avoid infinite recursion in Content::getObject()
With certain CMIS host URLs, it is possible that exception handler in Content::getObject() will recursively call itself with the same data (xParent from the same URL). This patch checks if the new URL is not the same as own, to avoid this. Change-Id: Ifaeb4ff27a9c809c5c96fa35ec190c3263a8fe62 Reviewed-on: https://gerrit.libreoffice.org/26977 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
This commit is contained in:
committed by
Andras Timar
parent
a389012950
commit
d1a32a01be
@@ -538,7 +538,9 @@ namespace cmis
|
||||
string sName = OUSTR_TO_STDSTR( aParentUrl.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ) );
|
||||
aParentUrl.removeSegment( );
|
||||
OUString sParentUrl = aParentUrl.GetMainURL( INetURLObject::NO_DECODE );
|
||||
|
||||
// Avoid infinite recursion if sParentUrl == m_sURL
|
||||
if (sParentUrl != m_sURL)
|
||||
{
|
||||
rtl::Reference<Content> xParent(new Content(m_xContext, m_pProvider, new ucbhelper::ContentIdentifier(sParentUrl)));
|
||||
libcmis::FolderPtr pParentFolder = boost::dynamic_pointer_cast< libcmis::Folder >(xParent->getObject(xEnv));
|
||||
if (pParentFolder)
|
||||
@@ -551,6 +553,7 @@ namespace cmis
|
||||
m_pObject = *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !m_pObject )
|
||||
throw libcmis::Exception( "Object not found" );
|
||||
|
Reference in New Issue
Block a user