[Libreoffice-commits] core.git: writerfilter/source

Jan Holesovsky kendy at suse.cz
Mon Apr 22 02:52:16 PDT 2013


 writerfilter/source/dmapper/DomainMapperTableManager.cxx |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 6d7dc74b382664ff8bc4c8790ec9febcb34716f4
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Apr 22 11:45:34 2013 +0200

    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

diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index bbdb53d..e10a3b6 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);


More information about the Libreoffice-commits mailing list