summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-09-29 13:08:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-09-29 16:04:32 +0200
commitc38d17b62c3ec206ccf484d701ff95cd037c6a4e (patch)
treecd98f357370254a650593d3226f42d3173b9ec92
parent5f1eb2a12b6e6ee646b5e9536822531ad0bd3259 (diff)
ofz#51859 Integer-overflow
Change-Id: I985164aad4f0133c258d6bdb8a4f38a75c3f7edf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140736 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/gdi/regionband.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/vcl/source/gdi/regionband.cxx b/vcl/source/gdi/regionband.cxx
index e772d5b27c5b..5a8e3676e57e 100644
--- a/vcl/source/gdi/regionband.cxx
+++ b/vcl/source/gdi/regionband.cxx
@@ -23,6 +23,7 @@
#include <tools/stream.hxx>
#include <regionband.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
@@ -676,8 +677,8 @@ void RegionBand::Move(tools::Long nHorzMove, tools::Long nVertMove)
// process the vertical move
if(nVertMove)
{
- pBand->mnYTop = pBand->mnYTop + nVertMove;
- pBand->mnYBottom = pBand->mnYBottom + nVertMove;
+ pBand->mnYTop = o3tl::saturating_add(pBand->mnYTop, nVertMove);
+ pBand->mnYBottom = o3tl::saturating_add(pBand->mnYBottom, nVertMove);
}
// process the horizontal move