sd/source/ui/func/fuzoom.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit bd22e7f9372ae1f89ada38b49d9fcebdea768c81
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Aug 8 16:24:29 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Aug 11 11:21:55 2022 +0200

    sd: avoid divide by zero in FuZoom::MouseMove
    
    See 
https://crashreport.libreoffice.org/stats/signature/sd::FuZoom::MouseMove(MouseEvent%20const%20&)
    
    Change-Id: I3b07def2ba088a92e2358e7db57c27c047165cef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137988
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 2f5366f05bed04d805cfe469b2ea58b029167095)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137971

diff --git a/sd/source/ui/func/fuzoom.cxx b/sd/source/ui/func/fuzoom.cxx
index aa5395267183..871d594d3368 100644
--- a/sd/source/ui/func/fuzoom.cxx
+++ b/sd/source/ui/func/fuzoom.cxx
@@ -117,10 +117,14 @@ bool FuZoom::MouseMove(const MouseEvent& rMEvt)
             {
                 Size aWorkSize = mpView->GetWorkArea().GetSize();
                 Size aPageSize = 
mpView->GetSdrPageView()->GetPage()->GetSize();
-                aScroll.setX( aScroll.X() / ( aWorkSize.Width()  / 
aPageSize.Width()) );
-                aScroll.setY( aScroll.Y() / ( aWorkSize.Height() / 
aPageSize.Height()) );
-                mpViewShell->Scroll(aScroll.X(), aScroll.Y());
-                aBeginPosPix = aPosPix;
+                if (aWorkSize.Width() != 0 && aWorkSize.Height() != 0 &&
+                        aPageSize.Width() != 0 && aPageSize.Height() != 0)
+                {
+                    aScroll.setX( aScroll.X() / ( aWorkSize.Width()  / 
aPageSize.Width()) );
+                    aScroll.setY( aScroll.Y() / ( aWorkSize.Height() / 
aPageSize.Height()) );
+                    mpViewShell->Scroll(aScroll.X(), aScroll.Y());
+                    aBeginPosPix = aPosPix;
+                }
             }
         }
         else

Reply via email to