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

New commits:
commit 8a4c16916b49cc096779bb9fab86a5a90f514ae3
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: Mon Sep 20 14:42:01 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/+/122351
    Tested-by: Jenkins
    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 21e645500fa0..52dbd6a3a59a 100644
--- a/sw/source/core/bastyp/swregion.cxx
+++ b/sw/source/core/bastyp/swregion.cxx
@@ -165,7 +165,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