[Libreoffice-commits] core.git: emfio/source

Caolán McNamara caolanm at redhat.com
Wed Oct 25 07:58:31 UTC 2017


 emfio/source/reader/emfreader.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit f519a99c76ef1f34f2b2d54e1c276326960fdf78
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Oct 24 12:47:28 2017 +0100

    ofz#3763 Integer-overflow
    
    Change-Id: If7c10d0fd188f0aafeece9545fb138761c3a2f5b
    Reviewed-on: https://gerrit.libreoffice.org/43765
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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 );


More information about the Libreoffice-commits mailing list