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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 5 08:06:15 UTC 2021


 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 0dab89d88f6b42065033f64b69a6e04a31d477d6
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Aug 5 08:16:53 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Aug 5 10:05:42 2021 +0200

    Remove harmful static_cast<int>
    
    ...that were present ever since the code's introduction in
    c6df405c6c5e41212d69282d4f632893f108fda2 "#i39532#", but cause
    `instdir/program/soffice --headless --convert-to pdf` of doc/abi5309-1.doc from
    the crash-testing corpus to fail under UBSan with
    
    > drawinglayer/source/processor2d/vclhelperbufferdevice.cxx:278:64: runtime error: -3.77964e+18 is outside the range of representable values of type 'int'
    
    Change-Id: Ieff00d6fe91e2ffef46876ef308351d3689c5ffe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120055
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index a0e29d7e6942..5e995ec0627b 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -275,10 +275,8 @@ impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const basegfx::B2DRange&
 {
     basegfx::B2DRange aRangePixel(rRange);
     aRangePixel.transform(mrOutDev.GetViewTransformation());
-    const ::tools::Rectangle aRectPixel(static_cast<sal_Int32>(floor(aRangePixel.getMinX())),
-                                        static_cast<sal_Int32>(floor(aRangePixel.getMinY())),
-                                        static_cast<sal_Int32>(ceil(aRangePixel.getMaxX())),
-                                        static_cast<sal_Int32>(ceil(aRangePixel.getMaxY())));
+    const ::tools::Rectangle aRectPixel(floor(aRangePixel.getMinX()), floor(aRangePixel.getMinY()),
+                                        ceil(aRangePixel.getMaxX()), ceil(aRangePixel.getMaxY()));
     const Point aEmptyPoint;
     maDestPixel = ::tools::Rectangle(aEmptyPoint, mrOutDev.GetOutputSizePixel());
     maDestPixel.Intersection(aRectPixel);


More information about the Libreoffice-commits mailing list