Author: orw
Date: Tue Oct 7 13:08:12 2014
New Revision: 1629885
URL: http://svn.apache.org/r1629885
Log:
125549: accept only positive values for SwTextGridItem::nBaseWidth
kudos to Mark Hung for defect finding and analysis
Modified:
openoffice/trunk/main/sw/inc/tgrditem.hxx
openoffice/trunk/main/sw/source/core/layout/atrfrm.cxx
Modified: openoffice/trunk/main/sw/inc/tgrditem.hxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/tgrditem.hxx?rev=1629885&r1=1629884&r2=1629885&view=diff
==============================================================================
--- openoffice/trunk/main/sw/inc/tgrditem.hxx (original)
+++ openoffice/trunk/main/sw/inc/tgrditem.hxx Tue Oct 7 13:08:12 2014
@@ -93,7 +93,14 @@ public:
//for textgrid enhancement
sal_uInt16 GetBaseWidth() const { return nBaseWidth;}
- void SetBaseWidth( sal_uInt16 nNew ) { nBaseWidth = nNew; }
+ void SetBaseWidth( sal_uInt16 nNew )
+ {
+ // only accept positive values
+ if ( nBaseWidth > 0 )
+ {
+ nBaseWidth = nNew;
+ }
+ }
sal_Bool IsSnapToChars() const { return bSnapToChars; }
sal_Bool GetSnapToChars() const { return bSnapToChars; }
Modified: openoffice/trunk/main/sw/source/core/layout/atrfrm.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/layout/atrfrm.cxx?rev=1629885&r1=1629884&r2=1629885&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/layout/atrfrm.cxx (original)
+++ openoffice/trunk/main/sw/source/core/layout/atrfrm.cxx Tue Oct 7 13:08:12
2014
@@ -2185,10 +2185,18 @@ sal_Bool SwFmtLineNumber::PutValue( cons
*************************************************************************/
SwTextGridItem::SwTextGridItem()
- : SfxPoolItem( RES_TEXTGRID ), aColor( COL_LIGHTGRAY ), nLines( 20 ),
- nBaseHeight( 400 ), nRubyHeight( 200 ), eGridType( GRID_NONE ),
- bRubyTextBelow( 0 ), bPrintGrid( 1 ), bDisplayGrid( 1 ),
- nBaseWidth(400), bSnapToChars( 1 ), bSquaredMode(1)
+ : SfxPoolItem( RES_TEXTGRID )
+ , aColor( COL_LIGHTGRAY )
+ , nLines( 20 )
+ , nBaseHeight( 400 )
+ , nRubyHeight( 200 )
+ , eGridType( GRID_NONE )
+ , bRubyTextBelow( 0 )
+ , bPrintGrid( 1 )
+ , bDisplayGrid( 1 )
+ , nBaseWidth( 400 )
+ , bSnapToChars( 1 )
+ , bSquaredMode( 1 )
{
}