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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 4 05:22:15 UTC 2021


 vcl/source/pdf/Matrix3.cxx |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 4115ad1035cb13e06ed00791415a4258767b8808
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Aug 3 22:13:45 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Aug 4 07:21:41 2021 +0200

    Remove harmful static_cast<int>
    
    ...that were present ever since the code's introduction in
    1ced26e19d769e2ac6ca83f57f82cddbd2cfd061 "INTEGRATION: CWS vcl15", but cause
    `instdir/program/soffice --headless --convert-to pdf` of doc/abi11923-2.doc from
    the crash-testing corpus to fail under UBSan with
    
    > vcl/source/pdf/Matrix3.cxx:30:35: runtime error: 2.14749e+09 is outside the range of representable values of type 'int'
    >  #0 in vcl::pdf::Matrix3::transform(Point const&) const at vcl/source/pdf/Matrix3.cxx:30:35 (instdir/program/libvcllo.so +0x94098c5)
    [...]
    
    Change-Id: I3855027effa09c592345a9c85a9d5dee38d7c992
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119955
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/source/pdf/Matrix3.cxx b/vcl/source/pdf/Matrix3.cxx
index 22e5c4d73344..475f87d966df 100644
--- a/vcl/source/pdf/Matrix3.cxx
+++ b/vcl/source/pdf/Matrix3.cxx
@@ -27,8 +27,7 @@ Matrix3::Matrix3()
 Point Matrix3::transform(const Point& rOrig) const
 {
     double x = static_cast<double>(rOrig.X()), y = static_cast<double>(rOrig.Y());
-    return Point(static_cast<int>(x * f[0] + y * f[2] + f[4]),
-                 static_cast<int>(x * f[1] + y * f[3] + f[5]));
+    return Point(x * f[0] + y * f[2] + f[4], x * f[1] + y * f[3] + f[5]);
 }
 
 void Matrix3::skew(double alpha, double beta)


More information about the Libreoffice-commits mailing list