summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2021-02-01 11:22:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-05 19:42:05 +0100
commitcfcd3db7d67d70e547a11141fa6cc91c38825e8b (patch)
treef129b0221305d8c5b3d6567f32799b5ca2b9df01 /basegfx
parenta5453daa11b02aff2b44907b2c87b3c4b56e8bd5 (diff)
tdf#139002 dont hang opening pathological SVGs
This is a workaround, but (a) this contains several pathological SVGs, which have clearly been very badly created eg. an svg path with 2699660320 elements. (b) the diagrams all look fine to me, so clearly the winding-rule change is not that critical in this case Change-Id: I48aac512e2de2ae4e63a4d1816c3d4d5901b3bf0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110242 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 8bb759e22e564a9076fdffee8705e62fbe545a35) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110437
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/polygon/b2dpolypolygoncutter.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
index e5094c7dd30d..f314fcb716cc 100644
--- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx
+++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx
@@ -27,6 +27,7 @@
#include <basegfx/range/b2drange.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/curve/b2dcubicbezier.hxx>
+#include <sal/log.hxx>
#include <vector>
#include <algorithm>
@@ -721,6 +722,12 @@ namespace basegfx::utils
B2DPolyPolygon createNonzeroConform(const B2DPolyPolygon& rCandidate)
{
+ if (rCandidate.count() > 1000)
+ {
+ SAL_WARN("basegfx", "this poly is too large, " << rCandidate.count() << " elements, to be able to process timeously, falling back to ignoring the winding rule, which is likely to cause rendering artifacts");
+ return rCandidate;
+ }
+
B2DPolyPolygon aCandidate;
// remove all self-intersections and intersections