From a8caa0ef1c0b5926caa9dfc4752c6d355dea6765 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 3 Apr 2017 16:42:08 +0200 Subject: 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 Tested-by: Jenkins --- vcl/source/gdi/pdfextoutdevdata.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vcl') 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(); -- cgit