[Libreoffice-commits] core.git: lotuswordpro/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 19 19:46:04 UTC 2021


 lotuswordpro/source/filter/lwprowlayout.cxx |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 770dcb1f717d576facf31efed14bee403e1a7155
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Sep 19 19:24:58 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Sep 19 21:45:32 2021 +0200

    ofz: avoid Timeout
    
    Change-Id: I8c5d1e7aaf256e182c2f5dd92bb8fd4ad9bff42a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122325
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index e37086960e2c..3b06b64efb67 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -463,10 +463,14 @@ void LwpRowLayout::SetCellSplit(sal_uInt16 nEffectRows)
 {
     for (LwpConnectedCellLayout* pConnCell : m_ConnCellList)
     {
-        sal_uInt16 nRowSpan = pConnCell->GetRowID()+pConnCell->GetNumrows();
-        if ( nRowSpan > nEffectRows )
+        sal_uInt16 nRowSpan;
+        if (o3tl::checked_add(pConnCell->GetRowID(), pConnCell->GetNumrows(), nRowSpan))
+            throw std::range_error("bad span");
+        if (nRowSpan > nEffectRows)
         {
-            pConnCell->SetNumrows(nEffectRows - pConnCell->GetRowID());
+            if (o3tl::checked_sub(nEffectRows, pConnCell->GetRowID(), nRowSpan))
+                throw std::range_error("bad span");
+            pConnCell->SetNumrows(nRowSpan);
         }
     }
 }


More information about the Libreoffice-commits mailing list