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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 26 06:41:32 UTC 2019


 drawinglayer/source/processor2d/contourextractor2d.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit cfbdbfdc9964f77b447a2b200398b3ab00cec1d7
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Jul 24 14:20:53 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jul 26 08:40:38 2019 +0200

    Be careful not to add empty rect representation to contour polypolygon
    
    The implementation of TextSimplePortionPrimitive2D::getB2DRange in
    drawinglayer/source/primitive2d/textprimitive2d.cxx can return an empty B2DRange
    (which is represented internally as a huge square with DBL_MIN/MAX coordindates)
    and adding that to maExtractedContour would later cause
    
    > include/tools/helpers.hxx:76:44: runtime error: 1.79769e+308 is outside the range of representable values of type 'long'
    >  #0 in FRound(double) at include/tools/helpers.hxx:76:44
    >  #1 in ImplPolygon::ImplPolygon(basegfx::B2DPolygon const&) at tools/source/generic/poly.cxx:474:30
    >  #2 in tools::Polygon::Polygon(basegfx::B2DPolygon const&) at tools/source/generic/poly.cxx:1849:72
    >  #3 in TextRanger::TextRanger(basegfx::B2DPolyPolygon const&, basegfx::B2DPolyPolygon const*, unsigned short, unsigned short, unsigned short, bool, bool, bool) at editeng/source/misc/txtrange.cxx:67:40
    >  #4 in std::_MakeUniq<TextRanger>::__single_object std::make_unique<TextRanger, basegfx::B2DPolyPolygon&, basegfx::B2DPolyPolygon*, int, unsigned short, unsigned short, bool, bool, bool>(basegfx::B2DPolyPolygon&, basegfx::B2DPolyPolygon*&&, int&&, unsigned short&&, unsigned short&&, bool&&, bool&&, bool&&) at /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/10.0.0/../../../../include/c++/10.0.0/bits/unique_ptr.h:930:34
    >  #5 in SwContourCache::ContourRect(SwFormat const*, SdrObject const*, SwTextFrame const*, SwRect const&, long, bool) at sw/source/core/text/txtfly.cxx:252:13
    
    when processing such a DBL_MAX = 1.79769e+308 coordinate while loading
    doc/ooo106646-2.doc (i.e., 3sem-program-electricity_and_magnetism.doc attached
    at <https://bz.apache.org/ooo/show_bug.cgi?id=106646#c13>).
    
    Change-Id: I7bcdf7fdb3a756d7fab0543697efeb8f92ceddb7
    Reviewed-on: https://gerrit.libreoffice.org/76261
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/drawinglayer/source/processor2d/contourextractor2d.cxx b/drawinglayer/source/processor2d/contourextractor2d.cxx
index 7e730bd2293e..5961cef14115 100644
--- a/drawinglayer/source/processor2d/contourextractor2d.cxx
+++ b/drawinglayer/source/processor2d/contourextractor2d.cxx
@@ -176,8 +176,11 @@ namespace drawinglayer
                 {
                     // primitives who's BoundRect will be added in world coordinates
                     basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D()));
-                    aRange.transform(getViewInformation2D().getObjectTransformation());
-                    maExtractedContour.emplace_back(basegfx::utils::createPolygonFromRect(aRange));
+                    if (!aRange.isEmpty())
+                    {
+                        aRange.transform(getViewInformation2D().getObjectTransformation());
+                        maExtractedContour.emplace_back(basegfx::utils::createPolygonFromRect(aRange));
+                    }
                     break;
                 }
                 default :


More information about the Libreoffice-commits mailing list