summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-09-19 14:31:11 +0200
committerEike Rathke <erack@redhat.com>2017-09-19 14:41:51 +0200
commitdc49b07446f15dd68a7469d4619954f5e13f6c17 (patch)
treefac45e2502953433a4b406fe1b57b628ff990b0c /svtools
parentfd0fff67798fea87217e65bb1561aa0d0e741c51 (diff)
renderToGraphic: assert document and target size
Specifically a document width or height of 0 leads to div/0 => -nan(0x8000000000000) => MapMode with 2147483648 => Fraction numerator overflow assert. Catch already here. Change-Id: I06588c64104733c2df8c2e1d6983ad95c9a74e57
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/filter/DocumentToGraphicRenderer.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx
index 93b6000029e9..e5885f618df2 100644
--- a/svtools/source/filter/DocumentToGraphicRenderer.cxx
+++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx
@@ -131,6 +131,9 @@ Graphic DocumentToGraphicRenderer::renderToGraphic(
if (!xDevice.is())
return Graphic();
+ assert( aDocumentSizePixel.Width() > 0 && aDocumentSizePixel.Height() > 0 &&
+ aTargetSizePixel.Width() > 0 && aTargetSizePixel.Height() > 0);
+
double fScaleX = aTargetSizePixel.Width() / (double) aDocumentSizePixel.Width();
double fScaleY = aTargetSizePixel.Height() / (double) aDocumentSizePixel.Height();