summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-01-28 16:43:28 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2021-01-25 13:17:57 +0100
commit6bd7aa50b3741e949f2138274ad2f74eea6b17a7 (patch)
tree0ab3dffa7c1565e3f3555397344485f09507c953
parentaeb75386098879d05385c6e31c01822a2c177ffa (diff)
ofz#20366 OOM
Change-Id: If658720502739e6ad88c3cf73ac6674e0313a48b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87648 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 090cf1e3bbe0ffaf56f22b152b73578483be2f42)
-rw-r--r--filter/source/graphicfilter/icgm/bitmap.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx
index 825c90243e0a..025ab1fc588a 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -316,7 +316,15 @@ bool CGMBitmap::ImplGetDimensions( CGMBitmapDescriptor& rDesc )
rDesc.mbStatus = false;
sal_uInt32 nHeaderSize = 2 + 3 * nPrecision + 3 * mpCGM->ImplGetPointSize();
- rDesc.mnScanSize = ( ( rDesc.mnX * rDesc.mnDstBitsPerPixel + 7 ) >> 3 );
+
+ sal_uInt32 nWidthBits;
+ if (o3tl::checked_multiply(rDesc.mnX, rDesc.mnDstBitsPerPixel, nWidthBits))
+ {
+ rDesc.mbStatus = false;
+ return false;
+ }
+
+ rDesc.mnScanSize = (nWidthBits + 7) >> 3;
sal_uInt32 nScanSize;
nScanSize = rDesc.mnScanSize;