diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-12 14:21:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-06-12 22:05:45 +0200 |
commit | 2927c7785d6bf6cef3f4bcc0bc3e463ac6a55b01 (patch) | |
tree | b7722441bdad7a454ca1d5c6a5eb5508094c373e /vcl | |
parent | faba9fa5d30290df5f8dd2bc0e97a287f20ef563 (diff) |
crashtesting: asserts on inability to scale oversize graphics
since...
commit d46c32140fdb05758c039dd27552b1788faac104
Date: Thu Jun 7 12:37:33 2018 +0200
assert in BitmapInfoAccess if bitmap is empty or we can't read from it
Change-Id: I138a53e9ce0763d4e62cfbba594abb323e807378
Reviewed-on: https://gerrit.libreoffice.org/55704
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/bitmap/BitmapScaleSuperFilter.cxx | 7 | ||||
-rw-r--r-- | vcl/source/gdi/gdimtf.cxx | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx index 2bea98bcbb29..f096bd7429ff 100644 --- a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx +++ b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx @@ -950,10 +950,17 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap) if (nDstW <= 1 || nDstH <= 1) return BitmapEx(); + { Bitmap::ScopedReadAccess pReadAccess(aBitmap); Bitmap aOutBmp(Size(nDstW, nDstH), 24); + Size aOutSize = aOutBmp.GetSizePixel(); + if (!aOutSize.Width() || !aOutSize.Height()) + { + SAL_WARN("vcl.gdi", "bmp creation failed"); + return BitmapEx(); + } BitmapScopedWriteAccess pWriteAccess(aOutBmp); diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index d0dded107ed3..aee51fb98b99 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -2818,7 +2818,9 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, BmpConversion eColorConve aBitmap.Scale(aDrawSize, nScaleFlag); // convert to desired bitmap color format - aBitmap.Convert(eColorConversion); + Size aSize(aBitmap.GetSizePixel()); + if (aSize.Width() && aSize.Height()) + aBitmap.Convert(eColorConversion); rBitmapEx = BitmapEx(aBitmap); } |