[Libreoffice-commits] core.git: svtools/source

Eike Rathke erack at redhat.com
Tue Sep 19 12:42:31 UTC 2017


 svtools/source/filter/DocumentToGraphicRenderer.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit dc49b07446f15dd68a7469d4619954f5e13f6c17
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 19 14:31:11 2017 +0200

    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

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();
 


More information about the Libreoffice-commits mailing list