sw/source/core/doc/doctxm.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 7489c032a33b6a14b20d389b6a10f5daeb853e95
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Nov 28 13:13:09 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Nov 28 15:46:04 2024 +0100

    cid#1607902 Overflowed constant
    
    Change-Id: Id43616644bc8495a6a5944de099ddfc29016bbe8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177484
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index fc2552385b70..af9d99e54433 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -693,8 +693,8 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& 
rType,
             if ( rNm.startsWith(aName) )
             {
                 // Calculate number and set the Flag
-                SwSectionFormats::size_type nNum = 
o3tl::toInt32(rNm.subView(nNmLen));
-                if( nNum-- && nNum < mpSectionFormatTable->size() )
+                sal_Int32 nNum = o3tl::toInt32(rNm.subView(nNmLen)) - 1;
+                if (nNum >= 0 && o3tl::make_unsigned(nNum) < 
mpSectionFormatTable->size())
                     pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
             }
             if ( bUseChkStr && sChkStr==rNm )

Reply via email to