summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-04 15:18:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-11-04 18:27:41 +0100
commitffb5ad4681f7f68b3b50dc4d94ea7ea8127da5e0 (patch)
tree1688eff387a0c7cbb4c76204131db17a48b131e9 /emfio
parent393fa77d278eae7a72a8dc78f81082bbdd63a656 (diff)
ofz#4055 Integer-overflow
Change-Id: I15f0a48c1e0c4c03f99a74d4d9b58e064d108c72 Reviewed-on: https://gerrit.libreoffice.org/44304 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/source/reader/mtftools.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 07b2a5b5b3f8..6e104c91fe94 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -2004,9 +2004,10 @@ namespace emfio
{
if ( mnMapMode == MM_ISOTROPIC ) //TODO: WHAT ABOUT ANISOTROPIC???
{
- Size aSize( (mnWinExtX + mnWinOrgX) >> MS_FIXPOINT_BITCOUNT_28_4,
- -((mnWinExtY - mnWinOrgY) >> MS_FIXPOINT_BITCOUNT_28_4));
-
+ sal_Int32 nX, nY;
+ if (o3tl::checked_add(mnWinExtX, mnWinOrgX, nX) || o3tl::checked_sub(mnWinExtY, mnWinOrgY, nY))
+ return;
+ Size aSize(nX >> MS_FIXPOINT_BITCOUNT_28_4, -(nY >> MS_FIXPOINT_BITCOUNT_28_4));
SetDevExt(aSize, false);
}
}