Kaydet (Commit) d1ba2cd6 authored tarafından Eike Rathke's avatar Eike Rathke

do not access vector elements beyond size, rhbz#847519 related

The actual bug (crash) is not triggered anymore because the categories
are assembled differently, nevertheless the code in question could
expose the same behavior under different preconditions.

Change-Id: Ic37f6b34effaf4e5252e80aab46b021547b36efb
üst ef3fb927
......@@ -353,11 +353,14 @@ Sequence< OUString > lcl_getExplicitSimpleCategories(
}
for( aOuterIt=rComplexCats.begin(); aOuterIt != aOuterEnd; ++aOuterIt )
{
sal_Int32 nCurrentCount = lcl_getCategoryCount( *aOuterIt );
if( nCurrentCount< nMaxCategoryCount )
if ( !aOuterIt->empty() )
{
ComplexCategory& rComplexCategory = aOuterIt->back();
rComplexCategory.Count += (nMaxCategoryCount-nCurrentCount);
sal_Int32 nCurrentCount = lcl_getCategoryCount( *aOuterIt );
if( nCurrentCount< nMaxCategoryCount )
{
ComplexCategory& rComplexCategory = aOuterIt->back();
rComplexCategory.Count += (nMaxCategoryCount-nCurrentCount);
}
}
}
}
......@@ -389,12 +392,15 @@ Sequence< OUString > lcl_getExplicitSimpleCategories(
OUString aText;
for( aOuterIt=aComplexCatsPerIndex.begin() ; aOuterIt != aOuterEnd; ++aOuterIt )
{
OUString aAddText = (*aOuterIt)[nN].Text;
if( !aAddText.isEmpty() )
if ( static_cast<size_t>(nN) < aOuterIt->size() )
{
if(!aText.isEmpty())
aText += aSpace;
aText += aAddText;
OUString aAddText = (*aOuterIt)[nN].Text;
if( !aAddText.isEmpty() )
{
if(!aText.isEmpty())
aText += aSpace;
aText += aAddText;
}
}
}
aRet[nN]=aText;
......
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