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