[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

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


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

New commits:
commit 6f86bad46d6cd64544bde1dc9367189c9a586c5e
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
    (cherry picked from commit a9b7ceea2bf3d6d38fb6c8a4c1fffb9be4714348)
    Reviewed-on: https://gerrit.libreoffice.org/599
    Reviewed-by: Luboš Luňák <l.lunak at suse.cz>
    Tested-by: Luboš Luňák <l.lunak at suse.cz>

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 2d3d4cb..f26e9ed 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -916,14 +916,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?
@@ -953,7 +959,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