Kaydet (Commit) e880a888 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

fix undefined behavior with out-of-bounds substring access

Change-Id: Ie40d3dd2947d41b62eae84f20cfe457d69cc4bfe
üst 383622a3
...@@ -220,13 +220,17 @@ OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_u ...@@ -220,13 +220,17 @@ OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_u
} }
else else
{ {
sal_Int32 nThisIndex = pEntry->GetName().copy( aUser.getLength() ).toInt32(); OUString aEntryName = pEntry->GetName();
if(aEntryName.getLength() >= aUser.getLength())
{
sal_Int32 nThisIndex = aEntryName.copy( aUser.getLength() ).toInt32();
if( nThisIndex >= nUserIndex ) if( nThisIndex >= nUserIndex )
nUserIndex = nThisIndex + 1; nUserIndex = nThisIndex + 1;
} }
} }
} }
} }
}
if (aUniqueName.isEmpty() && pPool1) if (aUniqueName.isEmpty() && pPool1)
{ {
......
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