sw/source/core/bastyp/swregion.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit b146e54a206a52da00de1fb98b49922bdea8cbce
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Mon Sep 20 12:04:33 2021 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Tue Sep 21 10:28:49 2021 +0200

    avoid division by zero
    
    A rectangle in SwRegionRects may apparently be empty.
    
    Change-Id: I0956be2921d5110e2a8b9867bebf99814dd222f1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122277
    Tested-by: Luboš Luňák <l.lu...@collabora.com>
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sw/source/core/bastyp/swregion.cxx 
b/sw/source/core/bastyp/swregion.cxx
index a54f9e4bddec..6a570bcdd091 100644
--- a/sw/source/core/bastyp/swregion.cxx
+++ b/sw/source/core/bastyp/swregion.cxx
@@ -166,7 +166,8 @@ void SwRegionRects::Compress()
             // that are possibly overlapping or adjacent or close enough to be 
grouped by the fuzzy
             // code below.
             const tools::Long nFuzzy = 1361513;
-            const tools::Long yMax = (*this)[i].Bottom() + nFuzzy / 
(*this)[i].Width();
+            const tools::Long yMax = (*this)[i].Bottom() + nFuzzy
+                / std::max<tools::Long>( 1, (*this)[i].Width());
             size_type j = i+1;
             while( j < size() && (*this)[j].Top() <= yMax )
                 ++j;

Reply via email to