diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-09-12 10:23:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-12 10:23:51 +0100 |
commit | a9b7ceea2bf3d6d38fb6c8a4c1fffb9be4714348 (patch) | |
tree | 1a37cb2ad7e7e42f155729cae6d448c83dc0f858 /writerfilter | |
parent | Improvement on previous commit (diff) | |
download | core-a9b7ceea2bf3d6d38fb6c8a4c1fffb9be4714348.tar.gz core-a9b7ceea2bf3d6d38fb6c8a4c1fffb9be4714348.zip |
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
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index aceba89b7684..669b5cb5a608 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 ); |