summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-07-14 15:47:04 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-07-14 22:18:05 +0200
commitd11313f341d1d9a9c73c736932441a89d5292e37 (patch)
tree94e6670375a92dfd2df4f8f45e44d9371ead6bee
parent3cf8c9df5d25694f170db9e95070badaaeaa371a (diff)
ofz#9116 Integer-overflow
Change-Id: I8715eaee5e71341beef1c146f5eca09581f87879 Reviewed-on: https://gerrit.libreoffice.org/57437 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index a06c4bc9f182..205e25deadda 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2074,12 +2074,12 @@ SwWW8ImplReader::SetAttributesAtGrfNode(SvxMSDffImportRec const*const pRecord,
Size aSz(pGrfNd->GetTwipSize());
// use type <sal_uInt64> instead of sal_uLong to get correct results
// in the following calculations.
- sal_uInt64 rHeight = aSz.Height();
- sal_uInt64 rWidth = aSz.Width();
- if( !rWidth && pF)
- rWidth = pF->nXaRight - pF->nXaLeft;
- else if( !rHeight && pF)
- rHeight = pF->nYaBottom - pF->nYaTop;
+ sal_uInt64 nHeight = aSz.Height();
+ sal_uInt64 nWidth = aSz.Width();
+ if (!nWidth && pF)
+ nWidth = o3tl::saturating_sub(pF->nXaRight, pF->nXaLeft);
+ else if (!nHeight && pF)
+ nHeight = o3tl::saturating_sub(pF->nYaBottom, pF->nYaTop);
if( pRecord->nCropFromTop || pRecord->nCropFromBottom ||
pRecord->nCropFromLeft || pRecord->nCropFromRight )
@@ -2088,19 +2088,19 @@ SwWW8ImplReader::SetAttributesAtGrfNode(SvxMSDffImportRec const*const pRecord,
// 16.16 (fraction times total
if( pRecord->nCropFromTop ) // image width or height resp.)
{
- aCrop.SetTop(lcl_ConvertCrop(pRecord->nCropFromTop, rHeight));
+ aCrop.SetTop(lcl_ConvertCrop(pRecord->nCropFromTop, nHeight));
}
if( pRecord->nCropFromBottom )
{
- aCrop.SetBottom(lcl_ConvertCrop(pRecord->nCropFromBottom, rHeight));
+ aCrop.SetBottom(lcl_ConvertCrop(pRecord->nCropFromBottom, nHeight));
}
if( pRecord->nCropFromLeft )
{
- aCrop.SetLeft(lcl_ConvertCrop(pRecord->nCropFromLeft, rWidth));
+ aCrop.SetLeft(lcl_ConvertCrop(pRecord->nCropFromLeft, nWidth));
}
if( pRecord->nCropFromRight )
{
- aCrop.SetRight(lcl_ConvertCrop(pRecord->nCropFromRight,rWidth));
+ aCrop.SetRight(lcl_ConvertCrop(pRecord->nCropFromRight, nWidth));
}
pGrfNd->SetAttr( aCrop );