From 770dcb1f717d576facf31efed14bee403e1a7155 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 19 Sep 2021 19:24:58 +0100 Subject: ofz: avoid Timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8c5d1e7aaf256e182c2f5dd92bb8fd4ad9bff42a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122325 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- lotuswordpro/source/filter/lwprowlayout.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lotuswordpro') 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); } } } -- cgit