vcl/headless/CairoCommon.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
New commits: commit 55d87b3a3fc87dca3114744f4a4e676ec51a9aa1 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Nov 21 21:06:51 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Nov 22 11:57:47 2022 +0100 ofz#53586 Out-of-memory Change-Id: I4442f6b6cd010706ccfded454e4c56b4ff001dbc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143077 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx index 96b119adcb6b..401571a7625c 100644 --- a/vcl/headless/CairoCommon.cxx +++ b/vcl/headless/CairoCommon.cxx @@ -621,6 +621,19 @@ bool CairoCommon::drawPolyLine(cairo_t* cr, basegfx::B2DRange* pExtents, const C return true; } + static const bool bFuzzing = utl::ConfigManager::IsFuzzing(); + if (bFuzzing) + { + const basegfx::B2DRange aRange(basegfx::utils::getRange(rPolyLine)); + if (aRange.getMaxX() - aRange.getMinX() > 0x10000000 + || aRange.getMaxY() - aRange.getMinY() > 0x10000000) + { + SAL_WARN("vcl.gdi", "drawPolyLine, skipping suspicious range of: " + << aRange << " for fuzzing performance"); + } + return true; + } + // need to check/handle LineWidth when ObjectToDevice transformation is used const bool bObjectToDeviceIsIdentity(rObjectToDevice.isIdentity()); @@ -707,6 +720,7 @@ bool CairoCommon::drawPolyLine(cairo_t* cr, basegfx::B2DRange* pExtents, const C cairo_set_line_join(cr, eCairoLineJoin); cairo_set_line_cap(cr, eCairoLineCap); + constexpr int MaxNormalLineWidth = 64; if (fLineWidth > MaxNormalLineWidth) { @@ -719,7 +733,6 @@ bool CairoCommon::drawPolyLine(cairo_t* cr, basegfx::B2DRange* pExtents, const C SAL_WARN("vcl.gdi", "drawPolyLine, suspicious input line width of: " << fLineWidth << ", will be " << fLineWidthPixel << " pixels thick"); - static const bool bFuzzing = utl::ConfigManager::IsFuzzing(); if (bFuzzing) { basegfx::B2DHomMatrix aObjectToDeviceInv(rObjectToDevice);