editeng/source/editeng/impedit3.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit d35d01937ac77a12b06c1884dae2ec53998cf088
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Dec 20 11:10:03 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Dec 20 12:14:40 2022 +0000

    editeng: avoid divide by zero
    
    Prevent mnColumns from ending up in a zero state.
    
    See
    
https://crashreport.libreoffice.org/stats/signature/ImpEditEngine::CreateAndInsertEmptyLine(ParaPortion%20*)
    
    Change-Id: I9137a0de33743ba514526cc28f4afef018de3614
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144580
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 2ce9a60f3eee..3191b7a874e7 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2832,8 +2832,14 @@ void ImpEditEngine::SetRotation(TextRotation nRotation)
 
 void ImpEditEngine::SetTextColumns(sal_Int16 nColumns, sal_Int32 nSpacing)
 {
+    assert(nColumns >= 1);
     if (mnColumns != nColumns || mnColumnSpacing != nSpacing)
     {
+        if (nColumns == 0)
+        {
+            SAL_WARN("editeng", "bad nColumns value, ignoring");
+            nColumns = 1;
+        }
         mnColumns = nColumns;
         mnColumnSpacing = nSpacing;
         if (IsFormatted())

Reply via email to