sw/source/core/layout/laycache.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 6ecad243cc17a6857a177b659c539f3be45a6ed1
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Thu Feb 20 14:17:19 2020 +0100
Commit:     Xisco Faulí <xiscofa...@libreoffice.org>
CommitDate: Fri Feb 21 15:57:52 2020 +0100

    tdf#129529 sw_redlinehide: infinite loop in SwLayHelper::CheckInsert()
    
    The bugdoc has this in meta.xml:
    
    meta:page-count="819" meta:paragraph-count="302"
    
    ... for which SwLayHelper::CalcPageCount() cunningly estimates a maximum
    of 0 paragraphs per page, and at that rate an infinite number of pages
    are required...
    
    Not sure what a reasonable minimum should be, paragraphs could be 16
    pages long even with 64k limit, but it does appear unlikely.
    
    (regression from 7e8b4756d95057f069467b34e7849f9354856578 which disabled
     the use of the layout-cache in the bugdoc)
    
    Change-Id: Icd9ab145cc2f0714b50de9b5b4a1ef10ac1d49a3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89106
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>
    (cherry picked from commit a9f2f4b4c9e1fa4e4c4a69517c31d0b8e2063f01)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88964
    Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org>
    (cherry picked from commit fef72fe382d04068cc5480f682125411c54d5dc2)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89130

diff --git a/sw/source/core/layout/laycache.cxx 
b/sw/source/core/layout/laycache.cxx
index dbf74df4b960..e3860c885f76 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -600,7 +600,9 @@ sal_uLong SwLayHelper::CalcPageCount()
         if ( nNdCount > 100 ) // no estimation below this value
         {
             if ( nPgCount > 0 )
-                mnMaxParaPerPage = nNdCount / nPgCount;
+            {   // tdf#129529 avoid 0...
+                mnMaxParaPerPage = std::max<sal_uLong>(3, nNdCount / nPgCount);
+            }
             else
             {
                 mnMaxParaPerPage = std::max( sal_uLong(20),
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to