summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-10-24 12:47:28 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-10-25 09:58:09 +0200
commitf519a99c76ef1f34f2b2d54e1c276326960fdf78 (patch)
tree95a5f4896001d9cd10290f4d78d75798b65768b1 /emfio
parentb6deca4b06764409c283f4599d71baef5b2df7f6 (diff)
ofz#3763 Integer-overflow
Change-Id: If7c10d0fd188f0aafeece9545fb138761c3a2f5b Reviewed-on: https://gerrit.libreoffice.org/43765 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/source/reader/emfreader.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index 08df186dd4ae..7411efc56b3b 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1470,10 +1470,12 @@ namespace emfio
ReadDIB(aBitmap, aTmp, true);
// test if it is sensible to crop
- if ( ( cxSrc > 0 ) && ( cySrc > 0 ) &&
- ( xSrc >= 0 ) && ( ySrc >= 0 ) &&
- ( xSrc + cxSrc <= aBitmap.GetSizePixel().Width() ) &&
- ( ySrc + cySrc <= aBitmap.GetSizePixel().Height() ) )
+ if ( (cxSrc > 0) && (cySrc > 0) &&
+ (xSrc >= 0) && (ySrc >= 0) &&
+ (aBitmap.GetSizePixel().Width() >= cxSrc) &&
+ (xSrc <= aBitmap.GetSizePixel().Width() - cxSrc) &&
+ (aBitmap.GetSizePixel().Height() >= cySrc) &&
+ (ySrc <= aBitmap.GetSizePixel().Height() - cySrc) )
{
tools::Rectangle aCropRect( Point( xSrc, ySrc ), Size( cxSrc, cySrc ) );
aBitmap.Crop( aCropRect );