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

New commits:
commit c108d0ce0e9cef747d4fb08c09a5191bd9d78f70
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Mar 5 16:58:06 2025 +0500
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Mar 13 17:22:37 2025 +0100

    tdf#165582: nMaxWidth may be negative
    
    Change-Id: Ibe4a57e8a098b219e2662d3ce8645d5caef98123
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182536
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit f6f1c7eb64a5b4ee44278e77e59305878979cfaa)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182872
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 24d7c6bd1561de150dd1ab33e624f1d2cab0d3ef)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182875

diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index e3e8c3bd9221..8706905fb720 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -227,11 +227,12 @@ static void GetLimitedStringPart(const SwTextFormatInfo& 
rInf, TextFrameIndex nI
                                  TextFrameIndex nLength, sal_uInt16 nComp, 
SwTwips nOriginalWidth,
                                  SwTwips nMaxWidth, TextFrameIndex& 
rOutLength, SwTwips& rOutWidth)
 {
-    assert(nMaxWidth >= 0);
     assert(nLength >= TextFrameIndex(0));
     const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
     rOutLength = nLength;
     rOutWidth = nOriginalWidth;
+    if (nMaxWidth < 0)
+        nMaxWidth = 0;
     while (rOutWidth > nMaxWidth)
     {
         TextFrameIndex nNewOnLineLengthGuess(rOutLength.get() * nMaxWidth / 
rOutWidth);

Reply via email to