From bac4b46e86f13fdbfc53a932bc61ac92a0f44f1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 6 Feb 2017 09:27:15 +0000 Subject: [PATCH] Resolves: ofz#547 Floating-point-exception Change-Id: I9612bef0198ce8f09d39f5000a31819c175027d1 --- filter/source/graphicfilter/ipict/ipict.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index 98aaf6f30c20..8e6a4ea8f3db 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -930,7 +930,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo if (nRowBytes < 8 || nPackType == 1) { - if (nHeight > pPict->remainingSize() / (sizeof(sal_uInt16) * nWidth)) + if (nWidth && nHeight > pPict->remainingSize() / (sizeof(sal_uInt16) * nWidth)) return 0xffffffff; } else @@ -1030,10 +1030,10 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo if ( nRowBytes < 8 || nPackType == 1 ) { const size_t nMaxPixels = pPict->remainingSize() / 4; - const size_t nMaxRows = nMaxPixels / nWidth; + const size_t nMaxRows = nWidth ? nMaxPixels / nWidth : SAL_MAX_UINT16; if (nHeight > nMaxRows) return 0xffffffff; - const size_t nMaxCols = nMaxPixels / nHeight; + const size_t nMaxCols = nHeight ? nMaxPixels / nHeight : SAL_MAX_UINT16; if (nWidth > nMaxCols) return 0xffffffff; @@ -1053,10 +1053,10 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo else if ( nPackType == 2 ) { const size_t nMaxPixels = pPict->remainingSize() / 3; - const size_t nMaxRows = nMaxPixels / nWidth; + const size_t nMaxRows = nWidth ? nMaxPixels / nWidth : SAL_MAX_UINT16; if (nHeight > nMaxRows) return 0xffffffff; - const size_t nMaxCols = nMaxPixels / nHeight; + const size_t nMaxCols = nMaxPixels ? nMaxPixels / nHeight : SAL_MAX_UINT16; if (nWidth > nMaxCols) return 0xffffffff;