You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.9 KiB
52 lines
1.9 KiB
11 years ago
|
From 3ef19ef7c5de8db17c693e2db286f79efbd98d8d Mon Sep 17 00:00:00 2001
|
||
|
From: Michael Stahl <mstahl@redhat.com>
|
||
|
Date: Fri, 7 Mar 2014 15:56:37 +0100
|
||
|
Subject: [PATCH] rhbz#1043551: sw: avoid division-by-0 in Text Grid painting
|
||
|
code
|
||
|
|
||
|
Possible to trigger with a document containing:
|
||
|
style:layout-grid-base-height="0cm"
|
||
|
|
||
|
(cherry picked from commit 71b55cf57460aec3fec948676251448934ba31d1)
|
||
|
|
||
|
got to love the sal_Int32 as long/int
|
||
|
(cherry picked from commit 18c89ae6ff01f3d555a7cb030eb4572d504e8de7)
|
||
|
|
||
|
Change-Id: Id3bd1f29157b39e8a577be0b87b86236dbe5a50c
|
||
|
---
|
||
|
sw/source/core/layout/atrfrm.cxx | 12 ++++++++++++
|
||
|
1 file changed, 12 insertions(+)
|
||
|
|
||
|
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
|
||
|
index b06cea4..3c40518 100644
|
||
|
--- a/sw/source/core/layout/atrfrm.cxx
|
||
|
+++ b/sw/source/core/layout/atrfrm.cxx
|
||
|
@@ -2262,12 +2262,24 @@ bool SwTextGridItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
|
||
|
bRet = (rVal >>= nTmp);
|
||
|
nTmp = MM100_TO_TWIP( nTmp );
|
||
|
if( bRet && (nTmp >= 0) && ( nTmp <= USHRT_MAX) )
|
||
|
+ {
|
||
|
+ // rhbz#1043551 round up to 5pt -- 0 causes divide-by-zero
|
||
|
+ // in layout; 1pt ties the painting code up in knots for
|
||
|
+ // minutes with bazillion lines...
|
||
|
+#define MIN_TEXTGRID_SIZE 100
|
||
|
if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEHEIGHT )
|
||
|
+ {
|
||
|
+ nTmp = std::max<sal_Int32>(nTmp, MIN_TEXTGRID_SIZE);
|
||
|
SetBaseHeight( (sal_uInt16)nTmp );
|
||
|
+ }
|
||
|
else if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEWIDTH )
|
||
|
+ {
|
||
|
+ nTmp = std::max<sal_Int32>(nTmp, MIN_TEXTGRID_SIZE);
|
||
|
SetBaseWidth( (sal_uInt16)nTmp );
|
||
|
+ }
|
||
|
else
|
||
|
SetRubyHeight( (sal_uInt16)nTmp );
|
||
|
+ }
|
||
|
else
|
||
|
bRet = false;
|
||
|
}
|
||
|
--
|
||
|
1.8.3.1
|
||
|
|