[Libreoffice-commits] core.git: emfio/source

Caolán McNamara caolanm at redhat.com
Tue Oct 24 15:43:53 UTC 2017


 emfio/source/reader/mtftools.cxx |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

New commits:
commit d6bf6c5851d19ee5f45ca18fc14ce85df6dc331d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Oct 24 11:35:10 2017 +0100

    ofz#3743 Divide-by-zero
    
    Change-Id: I6cdc8b4c852a126c8740fc23c10f9360d8caf1a5
    Reviewed-on: https://gerrit.libreoffice.org/43752
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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;
                 }


More information about the Libreoffice-commits mailing list