sw/source/filter/xml/xmlimpit.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 48b2cf6caffc0e0c11dc7cc112d9f3e8c2de4488
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Aug 12 09:41:01 2025 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Aug 19 16:50:32 2025 +0200

    cid#1660532 Overflowed constant
    
    Change-Id: Id0e494aa0465e6c04c7a8210597be891b734c461
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189821
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit b60a410a90bbe5fce235b38a5a92022b5a9bcdee)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189844
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/filter/xml/xmlimpit.cxx 
b/sw/source/filter/xml/xmlimpit.cxx
index 59678acf33ef..d488b99cf9b6 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -477,10 +477,11 @@ bool SvXMLImportItemMapper::PutXMLValue(
                             }
                         }
 
-                        if( nX < 0 ) nX *= -1;
-                        if( nY < 0 ) nY *= -1;
+                        if( nX < 0 ) nX = o3tl::saturating_toggle_sign(nX);
+                        if( nY < 0 ) nY = o3tl::saturating_toggle_sign(nY);
+                        const sal_Int32 nTotal = o3tl::saturating_add(nX, nY);
 
-                        rShadow.SetWidth( static_cast< sal_uInt16 >( (nX + nY) 
>> 1 ) );
+                        rShadow.SetWidth( static_cast< sal_uInt16 >( nTotal >> 
1 ) );
                     }
                 }
             }

Reply via email to