From 8f55160f25600039cb584975b8ff893f0453e485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 15 Oct 2024 13:05:28 +0100 Subject: [PATCH] cid#1606687 silence Overflowed integer argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I692ac9745c0f2811e7e8d155d0aeeee578d358fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175068 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/core/table/swtable.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index fbda582fb3f9..8fb34eb88f6b 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1221,14 +1221,13 @@ void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, } lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[nCurr], rParm.nOldWish, nOldWidth, true ); - bool bGoOn = !aRowSpanPos.empty(); sal_uInt16 j = nCurr; - while( bGoOn ) + while (!aRowSpanPos.empty() && j > 0) { - lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[--j], + j = o3tl::sanitizing_dec(j); + lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[j], rParm.nOldWish, nOldWidth, true ); lcl_AdjustWidthsInLine( rLines[j], aCopy, rParm, 0 ); - bGoOn = !aRowSpanPos.empty() && j > 0; } aRowSpanPos.clear(); }