diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-10-24 12:47:28 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-10-25 09:58:09 +0200 |
commit | f519a99c76ef1f34f2b2d54e1c276326960fdf78 (patch) | |
tree | 95a5f4896001d9cd10290f4d78d75798b65768b1 /emfio | |
parent | b6deca4b06764409c283f4599d71baef5b2df7f6 (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.cxx | 10 |
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 ); |