summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-03-18 11:48:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-03-18 16:15:31 +0100
commit0f31597dcc144cbb9c7dead9a6f2154ba1c044e6 (patch)
treed815152add9230c3dd09e847580dba88fd737bc8
parent9074f5602a9b0b51349647f29d8537256217ebe7 (diff)
ofz: Timeout in clipPolyPolygonOnPolyPolygon
Change-Id: I4257cd7133b29a2f5ae3407a5284965eb0814462 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131737 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/gdi/region.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index 22f2c3acc885..7567bd08d5bf 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -33,6 +33,7 @@
#include <basegfx/range/b2drange.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <tools/poly.hxx>
+#include <unotools/configmgr.hxx>
namespace
{
@@ -1570,6 +1571,13 @@ SvStream& ReadRegion(SvStream& rIStrm, vcl::Region& rRegion)
{
tools::PolyPolygon aNewPoly;
ReadPolyPolygon(rIStrm, aNewPoly);
+ const auto nPolygons = aNewPoly.Count();
+ if (nPolygons > 128)
+ {
+ SAL_WARN("vcl.gdi", "suspicously high no of polygons in clip:" << nPolygons);
+ if (utl::ConfigManager::IsFuzzing())
+ aNewPoly.Clear();
+ }
rRegion.mpPolyPolygon = aNewPoly;
}
}