[Libreoffice-commits] .: writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 12 03:03:08 PDT 2012


 writerfilter/source/dmapper/PropertyMap.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit a9b7ceea2bf3d6d38fb6c8a4c1fffb9be4714348
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 12 10:23:51 2012 +0100

    Resolves: rhbz#831755 crash with 0 dyaLinePitch in .docx
    
    This is similar to fdo#40686 (dyaLinePitch only valid between [1-31680]) for
    the .doc format
    
    Change-Id: I7d2745d695320b4b6b22ec2b519f092932587c2e

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index aceba89..669b5cb 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -904,14 +904,20 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
         if( aElement != end())
             aElement->second >>= eWritingMode;
 
-
-
         sal_Int32 nTextAreaHeight = eWritingMode == text::WritingMode_LR_TB ?
             nHeight - m_nTopMargin - m_nBottomMargin :
             nWidth - m_nLeftMargin - m_nRightMargin;
 
+        sal_Int32 nGridLinePitch = m_nGridLinePitch;
+        //sep.dyaLinePitch
+        if (nGridLinePitch < 1 || nGridLinePitch > 31680)
+        {
+            SAL_WARN("writerfilter", "sep.dyaLinePitch outside legal range: " << nGridLinePitch);
+            nGridLinePitch = 1;
+        }
+
         operator[]( PropertyDefinition( PROP_GRID_LINES, false )) =
-                uno::makeAny( static_cast<sal_Int16>(nTextAreaHeight/m_nGridLinePitch));
+                uno::makeAny( static_cast<sal_Int16>(nTextAreaHeight/nGridLinePitch));
 
         sal_Int32 nCharWidth = 423; //240 twip/ 12 pt
         //todo: is '0' the right index here?
@@ -941,7 +947,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
             nCharWidth += ConversionHelper::convertTwipToMM100( nFraction );
         }
         operator[]( PropertyDefinition( PROP_GRID_BASE_HEIGHT, false )) = uno::makeAny( nCharWidth );
-        sal_Int32 nRubyHeight = m_nGridLinePitch - nCharWidth;
+        sal_Int32 nRubyHeight = nGridLinePitch - nCharWidth;
         if(nRubyHeight < 0 )
             nRubyHeight = 0;
         operator[]( PropertyDefinition( PROP_GRID_RUBY_HEIGHT, false )) = uno::makeAny( nRubyHeight );


More information about the Libreoffice-commits mailing list