summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Dürr <hdu@apache.org>2013-07-16 13:30:18 +0000
committerHerbert Dürr <hdu@apache.org>2013-07-16 13:30:18 +0000
commita609daa146c5588c6a35c2c145e9573c625ec123 (patch)
tree38a5a62ab1589e51923ac79d039fa7188d4069ac
parentf56ded7c2aac573e4e5f060892327843eed23d0c (diff)
#i122752# check iterator in each iteration of CFormatEtcContainer::nextFormatEtc()'s loop
Don't trust nextFormatEtc()'s aNum argument not to mislead the iterator beyond the container bounds. The comparable loop in CFormatEtcContainer::skipFormatEtc() already checks the iterator against the container end in each iteration.
Notes
-rw-r--r--dtrans/source/win32/dtobj/FetcList.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/dtrans/source/win32/dtobj/FetcList.cxx b/dtrans/source/win32/dtobj/FetcList.cxx
index 531ae38be14a..ca455dc9ca4f 100644
--- a/dtrans/source/win32/dtobj/FetcList.cxx
+++ b/dtrans/source/win32/dtobj/FetcList.cxx
@@ -143,10 +143,11 @@ sal_uInt32 SAL_CALL CFormatEtcContainer::nextFormatEtc( LPFORMATETC lpFetc,
sal_uInt32 nFetched = 0;
- if ( m_EnumIterator != m_FormatMap.end( ) )
+ for ( sal_uInt32 i = 0; i < aNum; i++, nFetched++, lpFetc++, ++m_EnumIterator )
{
- for ( sal_uInt32 i = 0; i < aNum; i++, nFetched++, lpFetc++, ++m_EnumIterator )
- CopyFormatEtc( lpFetc, *m_EnumIterator );
+ if ( m_EnumIterator == m_FormatMap.end() )
+ break;
+ CopyFormatEtc( lpFetc, *m_EnumIterator );
}
return nFetched;