diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-11-06 09:00:18 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-11-06 22:27:15 +0100 |
commit | 133cc249c7a4881b5d53c06c1b660d3bf2cc03f7 (patch) | |
tree | 178c299b3ab8603c0585372811db05b9eec71a48 /svx/source/table | |
parent | 95d351871886e8c72f34e68140dade4fc21ad18b (diff) |
ofz#4072 Integer-overflow
Change-Id: Ib94d4021be86e93e6ed0e836fbab0d8d0ca6f738
Reviewed-on: https://gerrit.libreoffice.org/44346
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/table')
-rw-r--r-- | svx/source/table/tablelayouter.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx index 4eedf944b1bd..ea60278755d7 100644 --- a/svx/source/table/tablelayouter.cxx +++ b/svx/source/table/tablelayouter.cxx @@ -441,13 +441,17 @@ sal_Int32 TableLayouter::distribute( LayoutVector& rLayouts, sal_Int32 nDistribu do { + bConstrainsBroken = false; + // first enforce minimum size constrains on all entities for( nIndex = 0; nIndex < nCount; ++nIndex ) { Layout& rLayout = rLayouts[nIndex]; if( rLayout.mnSize < rLayout.mnMinSize ) { - nDistribute -= rLayout.mnMinSize - rLayout.mnSize; + sal_Int32 nDiff(0); + bConstrainsBroken |= o3tl::checked_sub(rLayout.mnMinSize, rLayout.mnSize, nDiff); + nDistribute -= nDiff; rLayout.mnSize = rLayout.mnMinSize; } } @@ -463,8 +467,6 @@ sal_Int32 TableLayouter::distribute( LayoutVector& rLayouts, sal_Int32 nDistribu nCurrentWidth = o3tl::saturating_add(nCurrentWidth, rLayout.mnSize); } - bConstrainsBroken = false; - // now distribute over entities if( (nCurrentWidth != 0) && (nDistribute != 0) ) { |