summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-04-05 17:04:47 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-04-05 20:37:32 +0200
commitb5602d5c853ce9479b2920743667e5af1cd63037 (patch)
tree1376ad56c70ec306f04574bc75ca78c884644a45 /emfio
parent768f09cfe416340839ea66081c805527bf6c7289 (diff)
ofz: skip slow path when fuzzing
Change-Id: I21d600f58174319ce6386de88ab9ac0ad371688b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113612 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/source/reader/emfreader.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index 7dbfd58a09de..3c40e3a6f914 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -24,6 +24,7 @@
#include <o3tl/safeint.hxx>
#include <tools/stream.hxx>
#include <memory>
+#include <unotools/configmgr.hxx>
#include <vcl/graph.hxx>
#include <vcl/pdfread.hxx>
#include <rtl/bootstrap.hxx>
@@ -359,6 +360,8 @@ bool ImplReadRegion( tools::PolyPolygon& rPolyPoly, SvStream& rStream, sal_uInt3
if (nLen < nSize)
return false;
+ bool bIsFuzzing = utl::ConfigManager::IsFuzzing();
+
for (sal_uInt32 i = 0; i < nCountRects; ++i)
{
rStream.ReadInt32(nLeft);
@@ -367,6 +370,10 @@ bool ImplReadRegion( tools::PolyPolygon& rPolyPoly, SvStream& rStream, sal_uInt3
rStream.ReadInt32(nBottom);
SAL_INFO("emfio", "\t\tLeft: " << nLeft << ", top: " << nTop << ", right: " << nRight << ", bottom: " << nBottom);
+
+ if (bIsFuzzing && i) // GetUnion is super slow, when fuzzing skip after first rect
+ continue;
+
tools::PolyPolygon aPolyPolyOr1(tools::Polygon(tools::Rectangle(nLeft, nTop, nRight, nBottom)));
rPolyPoly.GetUnion(aPolyPolyOr1, rPolyPoly);
}