summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-09-12 10:23:51 +0100
committerLuboš Luňák <l.lunak@suse.cz>2012-09-12 10:36:34 +0000
commit6f86bad46d6cd64544bde1dc9367189c9a586c5e (patch)
tree0a6f0eec574338552b14998ddeda81cc704e9121 /writerfilter
parenta0ab9803ec7e1effe7ff77fdfd13b9540ca7f6b8 (diff)
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@suse.cz> Tested-by: Luboš Luňák <l.lunak@suse.cz>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 2d3d4cb04b3f..f26e9ed2a0d1 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 );