diff options
author | Herbert Dürr <hdu@apache.org> | 2013-07-16 13:30:18 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2013-11-05 11:39:03 +0100 |
commit | c8dfaa0f0d35020724a2c62e90d405fe0dcc71cb (patch) | |
tree | d6f121e58d5626804f0bd92f6f9d0df55350b856 /dtrans/source | |
parent | 7b939f095b98e261593e73151c2846d77298795a (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.
(cherry picked from commit a609daa146c5588c6a35c2c145e9573c625ec123)
Signed-off-by: Jan Holesovsky <kendy@suse.cz>
Change-Id: Ie745497491679dfb172d78876c3a3731e153243e
Reviewed-on: https://gerrit.libreoffice.org/5241
Reviewed-by: Petr Mladek <pmladek@suse.cz>
Tested-by: Petr Mladek <pmladek@suse.cz>
Diffstat (limited to 'dtrans/source')
-rw-r--r-- | dtrans/source/win32/dtobj/FetcList.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/dtrans/source/win32/dtobj/FetcList.cxx b/dtrans/source/win32/dtobj/FetcList.cxx index 7031dacda8ea..8a30409ce8f7 100644 --- a/dtrans/source/win32/dtobj/FetcList.cxx +++ b/dtrans/source/win32/dtobj/FetcList.cxx @@ -132,10 +132,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; |