diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-11-04 15:18:22 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-11-04 18:27:41 +0100 |
commit | ffb5ad4681f7f68b3b50dc4d94ea7ea8127da5e0 (patch) | |
tree | 1688eff387a0c7cbb4c76204131db17a48b131e9 | |
parent | 393fa77d278eae7a72a8dc78f81082bbdd63a656 (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>
-rw-r--r-- | emfio/source/reader/mtftools.cxx | 7 |
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); } } |