Kaydet (Commit) 71b55cf5 authored tarafından Michael Stahl's avatar Michael Stahl

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"

Change-Id: Id3bd1f29157b39e8a577be0b87b86236dbe5a50c
üst 04cc0939
......@@ -2268,12 +2268,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(nTmp, MIN_TEXTGRID_SIZE);
SetBaseHeight( (sal_uInt16)nTmp );
}
else if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEWIDTH )
{
nTmp = std::max(nTmp, MIN_TEXTGRID_SIZE);
SetBaseWidth( (sal_uInt16)nTmp );
}
else
SetRubyHeight( (sal_uInt16)nTmp );
}
else
bRet = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment