vcl/source/gdi/region.cxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 0f31597dcc144cbb9c7dead9a6f2154ba1c044e6
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Mar 18 11:48:52 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Mar 18 16:15:31 2022 +0100

    ofz: Timeout in clipPolyPolygonOnPolyPolygon
    
    Change-Id: I4257cd7133b29a2f5ae3407a5284965eb0814462
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131737
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

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;
                 }
             }

Reply via email to