Kaydet (Commit) df58e602 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Michael Stahl

Incredible slowness and crashes with document with vast num of frame dups

it looks like draw:name values are supposed to be unique in ODF, even
if it's not spelled out explicitly, since it exists so the frame can be
referenced, which sort of implies that it has to be unique, so a
document where the values aren't unique can be considered invalid

    19.197.10 <draw:frame>
    The draw:name attribute specifies a name by which a <draw:frame>
element can be referenced.

So reject duplicate frames but limit this to document generated with
4.4.X which we believe is the version that created these bogus docs

(cherry picked from commit de0432a9)

Change-Id: I83f6d72fd969f667f0a8c2c85d2ffeeed672387a
Reviewed-on: https://gerrit.libreoffice.org/20054Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst e3ee6df3
...@@ -593,6 +593,7 @@ void XMLTextFrameContext_Impl::Create( bool /*bHRefOrBase64*/ ) ...@@ -593,6 +593,7 @@ void XMLTextFrameContext_Impl::Create( bool /*bHRefOrBase64*/ )
(!sName.isEmpty() && sOrigName != sName) ) (!sName.isEmpty() && sOrigName != sName) )
{ {
OUString sOldName( sName ); OUString sOldName( sName );
sal_Int32 i = 0; sal_Int32 i = 0;
while( xTextImportHelper->HasFrameByName( sName ) ) while( xTextImportHelper->HasFrameByName( sName ) )
{ {
...@@ -601,8 +602,15 @@ void XMLTextFrameContext_Impl::Create( bool /*bHRefOrBase64*/ ) ...@@ -601,8 +602,15 @@ void XMLTextFrameContext_Impl::Create( bool /*bHRefOrBase64*/ )
} }
xNamed->setName( sName ); xNamed->setName( sName );
if( sName != sOldName ) if( sName != sOldName )
xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME, {
bool bSuccess = xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME,
sOldName, sName ); sOldName, sName );
if (!bSuccess && GetImport().getGeneratorVersion() == SvXMLImport::LO_44x)
{
bCreateFailed = true;
return;
}
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment