summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-04-03 16:42:08 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-04-03 15:36:20 +0000
commita8caa0ef1c0b5926caa9dfc4752c6d355dea6765 (patch)
tree8ea1c6d6cfe50fade83f662160ff75045ba79460 /vcl
parent8c52dca558fc046db7480c7e483ba206b1b4df47 (diff)
vcl: avoid divide by zero in PDFExtOutDevData::HasAdequateCompression()
My stub graphic import filter created a graphic with 0 data size, don't crash on that. Change-Id: Ie9b93fce1bcae04d555a0610f674603c6945a54a Reviewed-on: https://gerrit.libreoffice.org/36048 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/pdfextoutdevdata.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index 0175d5faea91..f97f4002c871 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -828,6 +828,8 @@ bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic,
// FIXME: ideally we'd also pre-empt the DPI related scaling too.
Size aSize = rGraphic.GetSizePixel();
+ if (rGraphic.GetLink().GetDataSize() == 0)
+ return false;
sal_Int32 nCurrentRatio = (100 * aSize.Width() * aSize.Height() * 4) /
rGraphic.GetLink().GetDataSize();