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

Caolán McNamara caolanm at redhat.com
Wed Oct 25 14:37:42 UTC 2017


 emfio/source/reader/emfreader.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 6ff4688b36bd6ff1273cfc20639df1b1cddd4bb2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Oct 25 09:59:58 2017 +0100

    ofz#3776 Divide-by-zero
    
    Change-Id: I2de2bfd6165a53d05e9f222908f6764a608004c3
    Reviewed-on: https://gerrit.libreoffice.org/43813
    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/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index 7411efc56b3b..859c3510b759 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -745,7 +745,10 @@ namespace emfio
                     case EMR_SCALEWINDOWEXTEX :
                     {
                         mpInputStream->ReadUInt32( nNom1 ).ReadUInt32( nDen1 ).ReadUInt32( nNom2 ).ReadUInt32( nDen2 );
-                        ScaleWinExt( (double)nNom1 / nDen1, (double)nNom2 / nDen2 );
+                        if (nDen1 != 0 && nDen2 != 0)
+                            ScaleWinExt( (double)nNom1 / nDen1, (double)nNom2 / nDen2 );
+                        else
+                            SAL_WARN("vcl.emf", "ignoring bogus divide by zero");
                     }
                     break;
 
@@ -759,7 +762,10 @@ namespace emfio
                     case EMR_SCALEVIEWPORTEXTEX :
                     {
                         mpInputStream->ReadUInt32( nNom1 ).ReadUInt32( nDen1 ).ReadUInt32( nNom2 ).ReadUInt32( nDen2 );
-                        ScaleDevExt( (double)nNom1 / nDen1, (double)nNom2 / nDen2 );
+                        if (nDen1 != 0 && nDen2 != 0)
+                            ScaleDevExt( (double)nNom1 / nDen1, (double)nNom2 / nDen2 );
+                        else
+                            SAL_WARN("vcl.emf", "ignoring bogus divide by zero");
                     }
                     break;
 


More information about the Libreoffice-commits mailing list