summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2012-09-14 14:53:20 +0200
committerMichael Meeks <michael.meeks@suse.com>2012-09-17 09:53:02 +0000
commit517f98528e27bbecc308ad98a830fce5dca60bb3 (patch)
tree3f1ce1713abf9ec2f581d6f6363896f6a29d583d
parentc72c5c2c5e5d17dda25db33f0c9822ee0678b158 (diff)
fdo#44721 protect against negative calculated height value
Change-Id: I4faedd535421eaf1e3e425f4731b3bb8831e7360 Reviewed-on: https://gerrit.libreoffice.org/624 Reviewed-by: Michael Meeks <michael.meeks@suse.com> Tested-by: Michael Meeks <michael.meeks@suse.com>
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index dd142d48826a..699a755e8902 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -410,8 +410,10 @@ void OObjectBase::SetPropsFromRect(const Rectangle& _rRect)
if ( pPage && !_rRect.IsEmpty() )
{
uno::Reference<report::XSection> xSection = pPage->getSection();
- if ( xSection.is() && (static_cast<sal_uInt32>(_rRect.getHeight() + _rRect.Top()) > xSection->getHeight()) )
- xSection->setHeight(_rRect.getHeight() + _rRect.Top());
+ assert(_rRect.getHeight() >= 0);
+ const sal_uInt32 newHeight( ::std::max(0l, _rRect.getHeight()+_rRect.Top()) );
+ if ( xSection.is() && ( newHeight > xSection->getHeight() ) )
+ xSection->setHeight( newHeight );
// TODO
//pModel->GetRefDevice()->Invalidate(INVALIDATE_CHILDREN);