diff options
author | Jan Holesovsky <kendy@suse.cz> | 2013-04-22 11:45:34 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2013-04-22 11:51:52 +0200 |
commit | 6d7dc74b382664ff8bc4c8790ec9febcb34716f4 (patch) | |
tree | 0b14add527e5669623aa03fbf5583e373351379f | |
parent | 211dae4f0e9b8590953f17cab509e175d40aba5d (diff) |
n#382137: Do run out of bounds (& consequently crash) when we have 0 spans.
Maybe just works around the root issue (I did not debug deeper if this is
correct to have 0 here), but improves the code overall, so why not to do this.
Change-Id: I7c2b7f7e410faea5c1d6f3c15f1bc0f155dfb1f4
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableManager.cxx | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index bbdb53d4f017..e10a3b6cc858 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -551,12 +551,9 @@ void DomainMapperTableManager::endOfRowAction() ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( ); for( sal_uInt32 nBorder = 0; nBorder < m_nCell.back( ) - 1; ++nBorder ) { - sal_Int32 nGridCount = *aSpansIter; double fGridWidth = 0.; - do - { + for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; --nGridCount ) fGridWidth += (*pTableGrid.get())[nBorderGridIndex++]; - }while( --nGridCount ); sal_Int16 nRelPos = sal::static_int_cast< sal_Int16 >((fGridWidth * 10000) / nFullWidthRelative); |