Kaydet (Commit) aab10183 authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#3939 Integer-overflow

Change-Id: Ic35cf6dd77d536ba3ab486b1c752d81037fe7cae
Reviewed-on: https://gerrit.libreoffice.org/44103Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst b3788aee
...@@ -1413,14 +1413,17 @@ namespace emfio ...@@ -1413,14 +1413,17 @@ namespace emfio
ReadDIB(aBitmap, aTmp, true); ReadDIB(aBitmap, aTmp, true);
// test if it is sensible to crop // test if it is sensible to crop
if ( ( cxSrc > 0 ) && ( cySrc > 0 ) && if ( (cxSrc > 0) && (cySrc > 0) &&
( xSrc >= 0 ) && ( ySrc >= 0 ) && (xSrc >= 0) && (ySrc >= 0) &&
( xSrc + cxSrc <= aBitmap.GetSizePixel().Width() ) && (aBitmap.GetSizePixel().Width() >= cxSrc) &&
( ySrc + cySrc <= aBitmap.GetSizePixel().Height() ) ) (xSrc <= aBitmap.GetSizePixel().Width() - cxSrc) &&
(aBitmap.GetSizePixel().Height() >= cySrc) &&
(ySrc <= aBitmap.GetSizePixel().Height() - cySrc) )
{ {
tools::Rectangle aCropRect( Point( xSrc, ySrc ), Size( cxSrc, cySrc ) ); tools::Rectangle aCropRect( Point( xSrc, ySrc ), Size( cxSrc, cySrc ) );
aBitmap.Crop( aCropRect ); aBitmap.Crop( aCropRect );
} }
maBmpSaveList.emplace_back(new BSaveStruct(aBitmap, aRect, dwRop)); maBmpSaveList.emplace_back(new BSaveStruct(aBitmap, aRect, dwRop));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment