summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-10-24 11:35:10 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-10-24 17:43:30 +0200
commitd6bf6c5851d19ee5f45ca18fc14ce85df6dc331d (patch)
treed51d5dfb15326f74ed2e3e4f688a3501a16aa92d /emfio
parent38081c0884b64ed1132047973b4dccc42d548c89 (diff)
ofz#3743 Divide-by-zero
Change-Id: I6cdc8b4c852a126c8740fc23c10f9360d8caf1a5 Reviewed-on: https://gerrit.libreoffice.org/43752 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.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 7f8d477c7b22..96558d882ca4 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -478,12 +478,20 @@ namespace emfio
break;
default :
{
- fWidth /= mnWinExtX;
- fHeight /= mnWinExtY;
- fWidth *= mnDevWidth;
- fHeight *= mnDevHeight;
- fWidth *= (double)mnMillX * 100 / (double)mnPixX;
- fHeight *= (double)mnMillY * 100 / (double)mnPixY;
+ if (mnPixX == 0 || mnPixY == 0)
+ {
+ SAL_WARN("vcl.emf", "invalid scaling factor");
+ return Size();
+ }
+ else
+ {
+ fWidth /= mnWinExtX;
+ fHeight /= mnWinExtY;
+ fWidth *= mnDevWidth;
+ fHeight *= mnDevHeight;
+ fWidth *= (double)mnMillX * 100.0 / (double)mnPixX;
+ fHeight *= (double)mnMillY * 100.0 / (double)mnPixY;
+ }
}
break;
}