sw/source/core/txtnode/thints.cxx | 7 +++++-- sw/source/filter/ww8/ww8scan.cxx | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-)
New commits: commit 30f141ecd7bb7d92047eb501bc7902d74e7742bb Author: Caolán McNamara <[email protected]> AuthorDate: Sat Oct 19 19:23:16 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Oct 20 15:36:04 2024 +0200 cid#1607360 Overflowed constant Change-Id: I3bc311b2a9eab23de8f8a4db095ce2e068721f21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175242 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 4239a1b70ded..a8001e2cdf94 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -3199,7 +3199,8 @@ bool SwpHints::TryInsertHint( { // search for a reference with the same name SwTextAttr* pTmpHt; - for( size_t n = 0, nEnd = Count(); n < nEnd; ++n ) + size_t n = 0, nEnd = Count(); + while (n < nEnd) { const sal_Int32 *pTmpHtEnd; const sal_Int32 *pTmpHintEnd; @@ -3236,10 +3237,12 @@ bool SwpHints::TryInsertHint( if( bDelOld ) { NoteInHistory( pTmpHt ); - rNode.DestroyAttr( Cut( n-- ) ); + rNode.DestroyAttr( Cut( n ) ); --nEnd; + continue; // n removed, nEnd adjusted } } + ++n; } } break; commit 86550dd734c4ca05ccb8af667bbcb0058d3eb7b4 Author: Caolán McNamara <[email protected]> AuthorDate: Sat Oct 19 19:16:10 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Oct 20 15:35:57 2024 +0200 cid#1608476 Overflowed constant just set nRead to an initial 2 and leave nLen2 alone, nRead and nLen2 are only used for the loop condition Change-Id: I269db2d986070f010a05eb58f200d19afc1bff1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175241 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 2efeb1c1a49b..97af529488c7 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -4227,8 +4227,8 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen nLen = 2; nLen2 = o3tl::narrowing<sal_uInt16>(nLen); } - sal_uLong nRead = 0; - for( nLen2 -= 2; nRead < nLen2; ) + sal_uLong nRead = 2; + while (nRead < nLen2) { sal_uInt8 nBChar(0); rStrm.ReadUChar( nBChar );
