sw/source/filter/ww8/ww8par5.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5bc5c936e18ccfe20f219c8bf92bf6652d965269
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Jul 17 15:06:57 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Jul 17 20:44:13 2024 +0200

    cid#1606961 Overflowed array index read
    
    using a constexpr sal_uInt16 for the eMax limit, and dropping
    o3tl::narrowing might be enough to clear this bogus warning
    
    Change-Id: I6f7fd468333b39d597eccacf37e6a64926dfc015
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170635
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index cb65250a83c5..ceb1bf07fd99 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -805,7 +805,7 @@ void WW8FieldEntry::SetBookmarkCode(const OUString& 
bookmarkCode)
 tools::Long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes)
 {
     typedef eF_ResT (SwWW8ImplReader::*FNReadField)( WW8FieldDesc*, OUString& 
);
-    enum Limits {eMax = 96};
+    constexpr sal_uInt16 eMax = 96;
     static const FNReadField aWW8FieldTab[eMax+1] =
     {
         nullptr,
@@ -937,7 +937,7 @@ tools::Long SwWW8ImplReader::Read_Field(WW8PLCFManResult* 
pRes)
     if (bNested)
         return 0;
 
-    sal_uInt16 n = (aF.nId <= eMax) ? aF.nId : 
o3tl::narrowing<sal_uInt16>(eMax);
+    sal_uInt16 n = (aF.nId <= eMax) ? aF.nId : eMax;
     sal_uInt16 nI = n / 32;                     // # of sal_uInt32
     sal_uInt32 nMask = 1 << ( n % 32 );          // Mask for bits
 

Reply via email to